Answer the question
In order to leave comments, you need to log in
How to create all possible subdomains on nginx and direct to one site?
I'm trying to create a subdomain like *.localhost and here is my config:
server {
listen 127.0.0.1:80;
server_name localhost *.localhost;
root home/localhost/public_html;
index index.php index.html;
log_not_found off;
access_log logs/localhost-access.log main;
charset utf-8;
location ~ /\. { deny all; }
location = /favicon.ico { }
location = /robots.txt { }
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9071;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
The problem is solved, I had an error in this line in the configs:
location ~ /\. { deny all; }
Changed to to this and it all worked:
location / { }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question