比如在windows下,根目录为 F:\www\test\home\web
test.com 本地解析到该目录下面了,可以正常访问,nginx 配置如下
server { listen 80; server_name test.com; #charset koi8-r; #access_log logs/host.access.log main; root F:\www\test\home\web; location / { index index.html index.htm index.php; try_files $uri /index.php?$args; } location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { access_log off; expires 360d; try_files $uri =404; } 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; } location ~ /\.ht { deny all; } }
如何添加一个新的域名www.a.com 让 www.a.com/home 可以代理访问到test.com域名上面
再单独建一个文件就好了,配置