最新消息:

配置NGINX转发

科技 bill 157浏览 0评论

*以下红色内容按实际修改

添加虚拟主机

lnmp vhost add
#输入域名获得SSL证书,更改权限
chmod 755 /usr/local/nginx/conf/ssl/$YourDomain/

编辑$Vhost.conf

#/usr/local/nginx/conf/vhost/域名.conf

server
    {
        listen 80;
        #listen [::]:80;
        server_name $YourDomain ;
        return 301 https://$server_name$request_uri;
    }

server
    {
        listen 8088 http2;
        #listen [::]:443 ssl http2;
        server_name $YourDomain ;
        index index.html index.htm index.php default.html default.htm default.php;
        root  $RootUrl;

        include rewrite/wordpress.conf;
        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php-pathinfo.conf;

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

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

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log off;
    }

编辑Config.json

# /usr/local/etc/xray
{
    "log": {
        "loglevel": "warning"
    }, 
    "inbounds": [
        {
            "listen": "0.0.0.0", 
            "port": 443, 
            "protocol": "vless", 
            "settings": {
                "clients": [
                    {
                        "id": "$id", 
                        "level": 0, 
                        "email": "a@b.com",
                        "flow":"xtls-rprx-direct"
                    }
                ], 
                "decryption": "none", 
                "fallbacks": [
                    {
	                "alpn":"h2",
                        "dest": $dest
                    }
                ]
            }, 
            "streamSettings": {
                "network": "tcp", 
                "security": "xtls", 
                "xtlsSettings": {
                     "serverName": "$YouDomain",
                    "alpn": [
	                "h2",
                        "http/1.1"
                    ], 
                    "certificates": [
                        {
                            "certificateFile": "$CertUrl/fullchain.cer", 
                            "keyFile": "$CertUrl/$YouDomain.key"
                        }
                    ]
                }
            }
        }
    ], 
    "outbounds": [
        {
            "protocol": "freedom", 
            "settings": { }
        }
    ]
}

转载请注明:XMAO » 配置NGINX转发

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址