到 WordPress 主题文件夹的符号链接似乎不起作用

到 WordPress 主题文件夹的符号链接似乎不起作用

我正在尝试使用以下命令为自己构建一个自定义 WordPress 主题下划线tw

主题位置是:/home/j/code/mechanic360/wordpress_theme/mechanic360/theme

还有nginx受支持的本地 WordPress 网站位于/var/www/mechanic360/

我使用以下命令创建了符号链接:

sudo ln -s /home/j/code/mechanic360/wordpress_theme/mechanic360/theme /var/www/mechanic360/wp-content/themes/mechanic360

当我列出目录的内容时wp-content/themes,我看到:

~ ❯ ls /var/www/mechanic360/wp-content/themes                                                                                                                                                                              ✘ INT
Permissions Size User Date Modified Name
.rw-r--r--    28 http 15 Oct 20:51  index.php
lrwxrwxrwx@   61 root 16 Oct 16:06  mechanic360 -> /home/j/code/mechanic360/wordpress_theme/mechanic360/theme
drwxr-xr-x     - http 15 Oct 20:51  twentynineteen
drwxr-xr-x     - http 15 Oct 20:51  twentytwenty
drwxr-xr-x     - http 15 Oct 20:51  twentytwentyone

在正在运行的 WordPress 实例中,如果我通过仪表板转到主题,则不会看到列出的新主题。

我认为这可能是一个权限问题,所http使用的用户nginx无法访问我的主文件夹中的主题目录,所以我运行:

setfacl -m u:http:rwx ~/code/mechanic360/wordpress_theme/mechanic360/theme

可悲的是,这也没有帮助。我仍然无法在 WordPress 仪表板中看到我的主题。

nginx 配置

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
    
        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    }

    include sites-enabled/*;
}

然后在 下sites-enabled,我的站点的配置文件是:

# Upstream to abstract backend connection(s) for php
upstream php {
    server unix:/run/php-fpm/php-fpm.sock;
    server 127.0.0.1:9000;
}

server {
    ## Your website name goes here.
    server_name mechanic360.local;
    ## Your only path reference.
    root /var/www/mechanic360;
    ## This should be in your http block and if it is, it's not needed here.
    index index.php;

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

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        # This is cool because no php is touched for static content.
        # include the "?$args" part so non-default permalinks doesn't break when using query string
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_pass php;
        #The following parameter can be also included in fastcgi_params file
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
}

正如你所看到的,我没有disable_symlinks 选项设置,默认为off.

我缺少什么?

相关内容