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的配置文件中设置的域名一致
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。