0

I am trying to build myself a custom WordPress theme using underscoretw.

Theme location is: /home/j/code/mechanic360/wordpress_theme/mechanic360/theme

And the nginx powered, local WordPress site sits in /var/www/mechanic360/

I created a SymLink with the following command:

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

When I list the contents of the wp-content/themes directory, I see:

~ ❯ 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

In the running WordPress instance, if I go to themes via the dashboard, I don't see my new theme listed.

I thought it might have been a permission issue where the http user used by nginx can't access the theme directory in my home folder, so I ran:

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

Sadly, that did not help either. I still can't see my theme in the WordPress dashboard.

nginx config

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/*;
}

And then under sites-enabled, the config file for my site is:

# 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;
    }
}

As you can see, I do not have the disable_symlinks option set, and the default is off.

What am I missing?

J86
  • 339
  • 2
  • 4
  • 17

0 Answers0