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

私は何を見逃していますか?

ベストアンサー1

おすすめ記事