v2ray和宝塔web服务器同时使用80端口

1.首先需要安装完成宝塔面板和v2ray

2.新建单独的站点,填写绑定的域名处需要与host域名一致,我用的是ipm.atm.youku.com混淆

3.点击刚刚创建网站的设置,进入到配置文件的编辑

覆盖配置文件为

server
{
    listen 80;
    server_name ipm.atm.youku.com;
    index index.html;
    root /www/wwwroot/ipm.atm.youku.com;
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #SSL-END
    
    access_log  /www/wwwlogs/ipm.atm.youku.com.log;
    error_log  /www/wwwlogs/ipm.atm.youku.com.error.log;
    
location / {
        proxy_pass       http://127.0.0.1:8899; # 这里的8899改成你的v2ray服务所在端口
        proxy_redirect             off;
        proxy_http_version         1.1;
        proxy_set_header Upgrade   $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host      $http_host;
      
    }
}

混淆多个域名,就绑定需要混淆的域名就行

代码2:网站和v2ray共用一个站点配置

server
{
    listen 80;
	listen 443 ssl http2;
    server_name 网站域名 ipm.atm.youku.com pull.free.video.10010.com;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/ipm.atm.youku.com;
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    ssl_certificate    /www/server/panel/vhost/cert/ipm.atm.youku.com/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/ipm.atm.youku.com/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;

    #SSL-END
    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改
    include enable-php-74.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/ipm.atm.youku.com.conf;
    #REWRITE-END
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null; 
    }
    access_log  /www/wwwlogs/ipm.atm.youku.com.log;
    error_log  /www/wwwlogs/ipm.atm.youku.com.error.log;
location /cf1f/ {
        proxy_pass       http://127.0.0.1:8899;
        proxy_redirect             off;
        proxy_http_version         1.1;
        proxy_set_header Upgrade   $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host      $http_host;
      
    }
}

v2ray配置的时候【底层传输安全】这里留空

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片