nginx proxy_pass和LAN中的虚拟主机返回404


0

我希望这是有道理的。基本上,我已经使用nginx在MAC上设置了本地服务器,并为proxy_pass设置了以下规则:

    location /engine/rest {
        proxy_pass http://somedomain:9080/engine/rest;
    }

    location /engine/ {
        alias /data/www/pln/;
        index index.html;
    }

    location / {
        root /Applications/MAMP/htdocs/;
        index index.html index.htm index.php;
    }

我还运行了一个MAMP服务于虚拟主机,以便可以使用以下配置从Windows PC上访问它:

   <VirtualHost *:9090>

       DocumentRoot "/Applications/MAMP/htdocs"
       ServerAdmin root@localhost
       ServerName localhost

       <Directory /Applications/MAMP/htdocs/>
           AllowOverride All
           Order allow,deny
           Allow from all
       </Directory>

   </VirtualHost>

我已经在Windows PC中添加了该主机配置:

   192.168.1.3 machost

但是,当我在Windows上访问我的应用程序时,对于http://machost:9090/engine/test/someurl,它应该在nginx规则中传递的任何资源都返回404错误 。

我想我也需要在Nginx环境中添加一个虚拟主机配置,但我不是服务器人员(显然)。我该怎么办?

Answers:


1

我不确定,但我认为您应该使用以下方式更改default.conf

server {
    listen localhost:9080; #your public ip or some other which you want nginx listen
    server_name _;  
    location / {
              proxy_pass http://locahost; #site which is on apache
                }
   }

我不确定这个问题,如果回答不正确,我真的很抱歉。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.