VPS侦探论坛

 找回密码
 注册
查看: 4310|回复: 14

【已解决】非常感谢

[复制链接]
发表于 2016-7-21 11:28:08 | 显示全部楼层 |阅读模式

已解决,分成感谢

[ 本帖最后由 du45273117 于 2016-7-26 10:36 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-7-21 11:29:42 | 显示全部楼层


我现在的错误可能情况是:
1、domain2.com可以访问,但IP+8090无法访问;
2、domain2.com可以访问,但IP+8090直接访问到IP+80的主机;
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2016-7-21 14:53:15 | 显示全部楼层

我知道是的多站都是80 端口的情况下,直接按照提示配置就可以了!
想你这种情况我觉得你可以吧2站放在默认目录下,1站放在指定域名的那个文件夹下应该就可以了~当然需要手工修改多站的那个配置文件对应端口!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-7-21 14:55:25 | 显示全部楼层



因为在没有指定的情况下域名和ip访问都会访问默认配置目录~你就利用这点,实现2站的功能~
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-21 16:23:26 | 显示全部楼层

回复 3# 的帖子


不行的,2个站都需要IP+端口可以访问(一个是80一个非80)。

军哥运维代购:http://shop63846532.taobao.com/

发表于 2016-7-21 18:08:30 | 显示全部楼层

lnmp vhost add添加网站
改apache虚拟主机的端口
/usr/local/nginx/conf/下按proxy-pass-php.conf 创建多个单独不同名字的配置文件 ,改里面的端口
改nginx虚拟主机配置文件里的proxy-pass-php.conf 为你单独创建的,对应虚拟主机端口的配置文件
 楼主| 发表于 2016-7-22 13:25:06 | 显示全部楼层

回复 6# 的帖子


nginx下虚拟主机配置文件的端口不改吗?

我希望网站2访问地址是IP+8090

我操作如下:
复制一份proxy-pass-php.conf为proxy2-pass-php.conf
nginx下载虚拟主机配置文件端口改为8090
proxy2-pass-php.conf下apche和php端口都改为83
apache下虚拟主机配置文件端口改为83

iptables已经开启83端口,结果访问IP+8090是502错误

[ 本帖最后由 du45273117 于 2016-7-22 13:54 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-7-22 14:25:56 | 显示全部楼层

proxy2-pass-php.conf里面去掉php支持就可以。加上php支持就502!
proxy2-pass-php.conf内如如下:

        location /
        {
            try_files $uri @apache;
        }

        location @apache
        {
            internal;
            proxy_pass http://127.0.0.1:83;
            include proxy.conf;
        }

        location ~ [^/]\.php(/|$)
        {
            proxy_pass http://127.0.0.1:83;
            include proxy.conf;
        }



nginx虚拟主机配置文件如下:


server
    {
        listen 8090;
        #listen [::]:80;
        server_name virpus.imdupeng.cn;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/virpus.imdupeng.cn;

        #error_page   404   /404.html;
        include proxy-pass-php2.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log off;
    }


apache虚拟主机配置文件如下:

<VirtualHost *:83>
ServerAdmin webmaster@example.com
php_admin_value open_basedir "/home/wwwroot/virpus.imdupeng.cn:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/virpus.imdupeng.cn"
ServerName virpus.imdupeng.cn
#ErrorLog "/home/wwwlogs/-error_log"
#CustomLog "/home/wwwlogs/-access_log" combined
<Directory "/home/wwwroot/virpus.imdupeng.cn">
    SetOutputFilter DEFLATE
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    DirectoryIndex index.html index.php
</Directory>
</VirtualHost>

[ 本帖最后由 du45273117 于 2016-7-22 14:27 编辑 ]
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2016-7-23 08:52:01 | 显示全部楼层


502可能你apache挂了或配置文件有问题这个端口就没起来

你netstat -ntl 看一下

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2016-7-25 09:24:29 | 显示全部楼层

回复 9# 的帖子




83号端口确实没起来。
apache没挂!

8090端口是起来了的。

83端口iptables是accept的。

这种情况怎么处理?

[ 本帖最后由 du45273117 于 2016-7-25 09:34 编辑 ]
 楼主| 发表于 2016-7-25 10:17:27 | 显示全部楼层

是不是还需要改httpd.conf这个文件?
发表于 2016-7-25 15:25:36 | 显示全部楼层

回复 11# 的帖子


httpd.conf 里有listen 83吗?
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-25 15:29:50 | 显示全部楼层

回复 12# 的帖子

httpd.conf 默认只有listen 81,不行;

注释掉listen 81,添加 listen 83 ,是可以的!

我添加 了一个listen 83,保留listen 81 ,还是不行;
Listen 127.0.0.1:88
Listen 127.0.0.1:83

[ 本帖最后由 du45273117 于 2016-7-25 15:45 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2016-7-25 15:46:32 | 显示全部楼层
哦,谢谢军哥

[ 本帖最后由 du45273117 于 2016-7-26 10:34 编辑 ]

军哥运维代购:http://shop63846532.taobao.com/

发表于 2016-7-26 09:38:45 | 显示全部楼层

回复 14# 的帖子

直接访问域名肯定是访问到80端口啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-29 05:37 , Processed in 0.029784 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表