使用nginx映射docker容器端口
问题描述:
当一个位置有root用户,另一个位于proxy_pass时,nginx在url/laravel中不起作用。这个URL的响应是“404 Not Found”。如果我删除了url位置/和/ moda,url/laravel就起作用了。我这样做,因为我想要地图泊坞窗容器。使用nginx映射docker容器端口
nginx.conf文件:
server {
listen 80;
server_name local.monllar.com;
location /laravel {
root /var/www/local.monllar.com/public_html;
index index.html index.htm;
}
location/{
proxy_pass http://localhost:32768;
}
location /moda {
proxy_pass http://localhost:2222/moda;
}
}
答
我找到了解决办法。该泊坞窗容器的IPS映射到我的本地服务器名称
nginx.conf文件:
server
{
listen 80;
server_name local.monllar.com;
location/{
root /var/www/local.monllar.com/public_html;
index index.html index.htm;
}
}
server
{
listen 80;
server_name local.moda.com;
location/{
proxy_pass http://localhost:2222/moda/;
}
}
server
{
listen 80;
server_name local.laravel.com;
location/{
proxy_pass http://localhost:32768;
}
}
/私营/ etc/hosts文件中的Mac
127.0.0.1 local.monllar.com
127.0.0.1 local.moda.com
127.0.0.1 local.laravel.com
什么是你想实现文件? – user3151902
根位置不起作用 –
然后,应该在localhost:32768上监听的应用程序可能无法访问。你在nginx日志中有错误吗? – user3151902