Answer the question
In order to leave comments, you need to log in
Why can't I set up dynamic subdomains?
Actually, here is the config:
server {
listen 80;
server_name site *.site;
root /var/www/site/$subdomain;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.site$) {
set $subdomain $1;
}
if ($host ~* ^www.site$) {
set $subdomain "";
}
access_log /var/log/nginx/site.access.log;
error_log /var/log/nginx/site.error.log;
location / {
index index.php index.html;
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
127.0.0.1 localhost
127.0.1.1 MPCU
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 site
127.0.0.1 psql.site
No input file specified.
Answer the question
In order to leave comments, you need to log in
It can be seen from the config that when going to psql.site/, the server should read /var/www/site/psql.controversial curing
if ($host ~* ^([a-z0-9-\.]+)\.site$) {
root /var/www/site/$1;
}
server {
server_name psql.site;
root /var/www/site/psql;
access_log /var/log/nginx/psql.site.access.log;
error_log /var/log/nginx/psql.site.error.log;
location / {
index index.php index.html;
try_files \$uri \$uri/ /index.php?\$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question