Skip to content

Instantly share code, notes, and snippets.

@rajeshisnepali
Created March 3, 2020 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeshisnepali/756212b16873364bcb03cad956949907 to your computer and use it in GitHub Desktop.
Save rajeshisnepali/756212b16873364bcb03cad956949907 to your computer and use it in GitHub Desktop.
serve pages from directory according to subdomain name
server {
listen 80 ;
#server_name ~^(www\.)?(?<sname>.+?).<ip>.xip.io$;
server_name ~^(?<sname>.+?).<ip>.xip.io$;
root /var/www/html/review.anipat/$sname;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment