在Forge上安装Wordpress的子目录

时间:2018-12-05 17:01:52

标签: php wordpress laravel nginx laravel-forge

尝试通过forge将wordpress安装在AWS托管的站点的子目录上。我有一台在'learning-center'上安装了wordpress的服务器,另一个站点在'rootdomain.us'上安装了。

-伪造

-学习中心

--- public

-rootdomain.us

--- laravel-app

我已经编辑了rootdomain.us中的nginx配置,使其指向学习中心wordpress安装的公用文件夹,如下所示:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/rootdomain.us/before/*;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name rootdomain.us;
    root /home/forge/rootdomain.us/public;

    # FORGE SSL (DO NOT REMOVE!)
    ssl_certificate /etc/nginx/ssl/rootdomain.us/394250/server.crt;
    ssl_certificate_key /etc/nginx/ssl/rootdomain.us/394250/server.key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/rootdomain.us/server/*;

    location /learning-center {

        alias /home/forge/learning-center/public;

        try_files $uri $uri/ /index.php?$query_string;
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/rootdomain.us-error-custom.log error;

    error_page 404 /index.php;

    location ~ \.php$ {

        try_files $uri $uri/ @learning-center;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/rootdomain.us/after/*;

距离我最近的工作地点是哪个。唯一的问题是,当我到达URL时,它只是下载文件而不是运行PHP文件。有没有更简单的方法可以做到这一点?我愿意接受任何建议。因此,我发现最新的更新(可能是以前的更新)是,如果我转到wp-admin url,它将正常运行。但是,博客的根目录仍然无效。

0 个答案:

没有答案