【问题标题】:Nginx reverse proxy on python simplehttpserverpython simplehttpserver上的Nginx反向代理
【发布时间】:2016-10-27 19:07:59
【问题描述】:

我试图在 Python SimpleHTTPServer 上设置 NGINX 反向代理。 /etc/nginx/conf.d 中存在我的web.conf 文件,文件中存在的设置如下。

server {
    server_name localhost;

    location / {
        proxy_pass http://192.168.1.3:8000/;
    } 
}

我的 NGINX 已启动并正在运行。我在保存web.conf 文件后重新加载。另一方面,我也在目录 home/user/projects/

中运行 Python SimpleHTTPServer

但是,当我打开浏览器并访问 localhost 时,它会显示 NGINX 欢迎页面,而不是运行 Python SimpleHTTPServer 的目录中的 index.html 文件。

【问题讨论】:

    标签: python nginx reverse-proxy simplehttpserver


    【解决方案1】:

    两件事:

    1- 您忘记在配置文件中指定监听端口 只需添加:

    listen 80;
    

    2-默认配置仍然有效检查是否有符号链接称为默认:

    /etc/nginx/sites-enabled/
    

    并删除它 3-最好在

    中添加您的设置文件
    /etc/nginx/sites-available/
    

    然后在 sites-enabled 中创建一个符号链接,这样如果你想停用站点而不是删除配置,你可以删除符号链接。而不是把它放在 conf.d 中。

    查看how to configure nginx了解更多详情

    【讨论】:

      猜你喜欢
      • 2020-07-11
      • 1970-01-01
      • 1970-01-01
      • 2020-01-05
      • 2021-12-01
      • 2018-05-28
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      相关资源
      最近更新 更多