【问题标题】:Can´t solve 403 Forbidden Error [nginx - windows]无法解决 403 禁止错误 [nginx - windows]
【发布时间】:2014-05-08 16:47:28
【问题描述】:

我尝试了几次来解决我的问题,但我没有找到任何解决我的问题的方法!

我可以从我的 vps 访问我的网站,但如果我从本地计算机尝试它,我会收到 403 错误!

如果有人可以帮助我,那就太好了!

PS:我不想显示带有自动索引的文件!!!

我的 nginx.conf:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;


        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.php;
            allow    all;
        }

        #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;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  C:/nginx/html/$fastcgi_script_name;
            include        fastcgi_params;

        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server

   server {
        listen       443 ssl;
        server_name  localhost;

        ssl_certificate      localhost.crt;
        ssl_certificate_key  localhost.key;

        #ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

    }


}

【问题讨论】:

  • 你在浏览器的地址栏中输入什么来访问这个网站?本地主机?
  • 这个问题似乎属于 Stack Exchange 网络中的另一个站点,因为它与编程无关。也许是Super UserServer Fault

标签: windows nginx http-status-code-403


【解决方案1】:

以管理员身份运行为我解决了这个问题。

我也有同样的问题。使用 Chocolatey 安装 nginix。这也将 nginx 安装为服务。 遇到这个问题后,我停止了服务并以管理员身份启动了 nginx。 只需右键单击 exe 文件并选择以管理员身份运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-02
    • 1970-01-01
    • 2016-10-15
    • 2013-07-19
    • 2016-03-26
    • 1970-01-01
    • 1970-01-01
    • 2020-05-01
    相关资源
    最近更新 更多