安装正常步骤搭建lnmp+wordpress
安装Xray

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root

参考

安装完毕以后,在目录 /usr/local/etc/xray 找到 config.json 文件,编辑配置文件

{
    "log": {
        "loglevel": "debug",
        "access": "/var/log/xray/access.log",
        "error": "/var/log/xray/error.log"
    },

    "inbounds": [
        {
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "68b0fb83-4574-4204-8856-64c248715c97", 
                        "flow": "xtls-rprx-direct",
                        "level": 0,
                        "email": "test@qq.com"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "alpn": "h2",
                        "dest": 8080
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "xtls",
                "xtlsSettings": {
                    "alpn": [
                        "http/1.1"
                    ],
                    "certificates": [
                        {
                            "certificateFile": "/root/ssl/1_bananatest.top_bundle.crt",
                            "keyFile": "/root/ssl/2_bananatest.top.key"
                        }
                    ]
                }
            }
        }
    ],

  "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

修改nginx配置文件

server {
    listen 80;
    server_name  bananatest.top;
    return 301 https://bananatest.top$request_uri;
}
server
    {
        listen 8080;
        server_name bananatest.top;##你的域名
        index index.html index.htm index.php;
        root  /home/wwwroot/default;
        add_header Content-Security-Policy "upgrade-insecure-requests";##重要
        add_header Strict-Transport-Security "max-age=63072000" always;##重要

        #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.conf;

        location / 
        {
          try_files $uri $uri/ /index.php?$args;
        }


        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

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

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

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

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access.log;
        error_log  /home/wwwlogs/error.log;
    }

重启nginx和Xray

systemctl restart xray
nginx -s reload