Apache 配置是否需要在 apache LISTEN 绑定中反映 Nginx 上游 apache 代理?
Nginx 运行在 Apache 前面,并为 Apache VirtualHost 做代理(IP:端口)。当 Nginx 在 Apache 之前启动时,Apache 会出错并显示端口已在使用消息。 httpd.conf 应该读取:Listen 80 还是 Listen 10.7.5.53:8051?或收听 127.0.0.1:8051。粘贴如下:
##NGINX
location / {
root /var/www/wordpress/somename/;
index index.php index.html index.htm;
proxy_pass http://127.0.0.1:8051;
proxy_read_timeout 1200;
proxy_send_timeout 1200;
proxy_connect_timeout 75
}
##APACHE
<VirtualHost *:80>
ServerName somename.com
ServerAlias www.somename.com
</VirtualHost>
<VirtualHost *:443>
ServerAlias www.somename.com
DocumentRoot "/var/www/wordpress/somename"
</VirtualHost>
Nginx is running in front of Apache and does a proxy (IP:port) for the Apache VirtualHost. When Nginx is started before Apache, Apache errors out with port already in use message. Should httpd.conf read: Listen 80 or Listen 10.7.5.53:8051? or Listen 127.0.0.1:8051. Paste follows:
##NGINX
location / {
root /var/www/wordpress/somename/;
index index.php index.html index.htm;
proxy_pass http://127.0.0.1:8051;
proxy_read_timeout 1200;
proxy_send_timeout 1200;
proxy_connect_timeout 75
}
##APACHE
<VirtualHost *:80>
ServerName somename.com
ServerAlias www.somename.com
</VirtualHost>
<VirtualHost *:443>
ServerAlias www.somename.com
DocumentRoot "/var/www/wordpress/somename"
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设 Nginx 侦听端口 80,Apache 无法侦听同一端口。由于 Nginx 代理端口 8051,我可以假设 Apache 应该侦听端口 8051,而不是端口 80。 1 软件 == 1 端口,你不能双重侦听。
因此,
Listen *:8051
并修改端口 8051 的
。Assuming Nginx listens on port 80, Apache cannot listen on that same port. And since Nginx proxies to port 8051, I can assume Apache should be listening on port 8051, and not port 80. 1 software == 1 port, you cannot double listen.
So
Listen *:8051
and modify the<VirtualHost>
for port 8051 as well.