Last active
April 14, 2016 02:31
-
-
Save zhangyoufu/2fe617beccf95d8854490de0050713bd to your computer and use it in GitHub Desktop.
bring lighttpd mod_simple_vhost to nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # for test purpose only, do not use in production | |
| # inspired by http://blog.pkh.me/p/4-simple_vhost-with-nginx.html | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| server_name default; | |
| server_name_in_redirect off; | |
| set $vpath /srv/_vhost/$host; | |
| if ( !-d $vpath ) { | |
| set $vpath /srv/default; | |
| } | |
| root $vpath; | |
| error_page 403 =404 /; | |
| location / { | |
| index index.php index.html; | |
| } | |
| location ^~ /_public { | |
| autoindex on; | |
| } | |
| location ~ \.php$ { | |
| fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
| include fastcgi.conf; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment