简体   繁体   English

Nginx重写URL仅适用于root用户

[英]Nginx rewrite url only works on root

server {
    listen       80;
    server_name  www.domain.com domain.com;
    error_page 404 /?404;
    error_page 403 /?404;

    location / {
        autoindex off;
        root   c:/webserver/html;
        index  default.asp index.php default.html;
        rewrite ^/([^/]*)$ /?action=$1 break;
    }

I got lines of code in my nginx.conf. 我的nginx.conf中包含代码行。 this rewrite url works perfect on localhost but when I installed nginx on my vps and tried to reach from pc it doesn't work. 这个重写的URL在本地主机上是完美的,但是当我在我的vps上安装nginx并尝试从pc到达时,它是行不通的。

Thanks for answers. 谢谢你的回答。

Try to change that : 尝试更改:

server_name www.domain.com domain.com;

with your domain name or server ip. 与您的域名或服务器IP。

Then, you must restart our Nginx server for these changes to be recognized. 然后,您必须重新启动我们的Nginx服务器,才能识别这些更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM