lnmpa添加主机时怎么绑定指定的独立IP
是不是 修改/usr/local/nginx/conf/vhost/域名.conf在listen 后面加上IP
即可 其他是否还需要改动? 添加后需要修改/usr/local/nginx/conf/vhost/域名.conf和 /usr/local/apache/conf/vhost/域名.conf的listen
然后分别重启nginx和apache /usr/local/nginx/conf/vhost/域名.conf 里面有listen 后直接加IP
以下内容要不要更改??
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ .*\.(php|php5)?$
{
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
/usr/local/apache/conf/vhost/域名.conf 内容如下
<VirtualHost *:88>
ServerAdmin webmaster@example.com
DocumentRoot "/home/wwwroot/XXX.com"
ServerName XXX.com
ServerAliasXXX.com
#ErrorLog "logs/-error_log"
#CustomLog "logs/-access_log" common
</VirtualHost>
请教军哥具体如何修改,谢谢。 不需要改
<VirtualHost *:88>改成<VirtualHost ip:88>
若改apache的vhost,会得到以下结果:
Nginx program is stopVirtualHost 11.22.33.44:88 overlaps with VirtualHost 11.22.33.44:88, the first has precedence, perhaps you need a NameVirtualHost directive
Shutting down MySQL. SUCCESS!
MySQL program is stop
Starting LNMPA...
Nginx start successfully!
VirtualHost 11.22.33.44:88 overlaps with VirtualHost 11.22.33.44:88, the first has precedence, perhaps you need a NameVirtualHost directive
Starting MySQL.. SUCCESS!
MySQL start successfully!
回复 5# 的帖子
关于这个问题(VPS有两个及以上的IP,想建两个及以上的站并给他们每个都分配一个独立IP) 我研究了很长时间才搞明白些有两种需求,所以有两种设置
1、给域名分配个独立IP
仅仅只需要在 /usr/local/nginx/conf/vhost/域名.conf 里面有listen 后直接加IP 然后重启NGINX即可
但访问指定IP时 会到/home/wwwroot/ 所以/home/wwwroot/下不要放网站
2、无论访问域名还是指定IP 都能到绑定的站
需要修改/usr/local/nginx/conf/vhost/域名.conf和 /usr/local/apache/conf/vhost/域名.conf的listen
以下127.0.0.1改成指定IP
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include proxy.conf;
}
location ~ .*\.(php|php5)?$
{
proxy_pass http://127.0.0.1:88;
include proxy.conf;
修改/usr/local/apache/conf/extra/httpd-vhosts.conf 里的 NameVirtualHost *:88,如果分配了几个IP就写几个
比如
NameVirtualHost 1.1.1.1:88
NameVirtualHost 2.2.2.2:88
然后 /root/lnmpa restart
不过这样有个弊端 就是NGINX获取不到APACHE处理的客户端IP 比如WORDPRESS里的访客留言显示的IP都是帮定的IP
以上是个人尝试多次得出的结论 不一定是标准 可能走了些弯路 还请完美解决了这一问题的兄弟指点 独立ip记号,将来备用。 :victory: :victory: :victory:
页:
[1]