Last active
January 4, 2016 04:49
-
-
Save JingwenTian/8571390 to your computer and use it in GitHub Desktop.
nginx泛域名解析实现二级域名多域名详细说明: http://www.jingwentian.com/t-34
This file contains 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
server { | |
listen 80; | |
server_name ~^(?<subdomain>.+)\.jingwentian\.com$; | |
root /home/wwwroot/jingwentian/$subdomain; | |
index index.html index.htm index.php; | |
fastcgi_intercept_errors on; | |
error_page 404 = /404.html; | |
location / { | |
# This is cool because no php is touched for static content. | |
# include the "?$args" part so non-default permalinks doesn't | |
# break when using query string | |
try_files $uri $uri/ =404; | |
} | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
#location ~ \.php$ { | |
# fastcgi_pass 127.0.0.1:9000; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# fastcgi_param domain $subdomain; | |
# include fastcgi_params; | |
#} | |
location ~ .*\.(php|php5)?$ { | |
try_files $uri =404; | |
fastcgi_pass unix:/tmp/php-cgi.sock; | |
fastcgi_index index.php; | |
include fcgi.conf; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment