- server {
- listen 80;
- #server_name localhost;
- server_name hhy.com;/** 这里写自己的域名 */
- #charset koi8-r;
- #access_log logs/host.access.log main;
- # root "F:/PHPstudy/PHPTutorial/WWW";
- root "F:/PHPstudy/PHPTutorial/WWW/ShopMall";
- location / {
- index index.html index.htm index.PHP l.PHP;
- /** 下面的 if 判断就是隐藏 index.PHP*/
- if (!-e $request_filename) {
- rewrite ^(.*)$ /index.PHP?s=/$1 last;
- break;
- }
- autoindex off;
- }
- #error_page 404 /404.HTML;
- # redirect server error pages to the static page /50x.HTML
- #
- error_page 500 502 503 504 /50x.HTML;
- location = /50x.HTML {
- root HTML;
- }
nginx 服务器的配置文件是 nginx.conf , 注意配置文件的最后是否有加载其他配置文件
打开我的电脑, 目录是 C:\Windows\System32\drivers\etc 下的 hosts 文件, 在最下面加上 127.0.0.1 hhy.com, 添加的域名一定要跟 nginx 的配置文件中设置的域名一致
来源: http://www.bubuko.com/infodetail-3025354.html