Hello everyone,
I built a WordPress site working fine. The address is "http://mydomain.com" for example.
Then I would like to indicate "http://mydomain.com/data/" to /home/data/index.html .
So I modified the following /etc/nginx/default.d/locations.conf file.
$ cat locations.conf
location ~* /wp-config.php {
deny all;
}
# Beginning of Insertion this time
location /data/ {
root /home/data;
index index.html;
}
# End of Insertion this time
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
$
After restarting nginx I accessed "http://mydomain.com/data/".
Then browser showed /usr/share/nginx/html/404.html file.
The permission and owner of /home/data/index.html is the following.
$ LANG=en ls -la /home/data
total 4
drwxrwxrwx 2 nginx nginx 24 Jan 5 11:52 .
drwxr-xr-x. 5 root root 42 Jan 5 11:37 ..
-rw-rw-r-- 1 nginx nginx 142 Dec 15 18:30 index.html
$
How should I write the configuration file?
Please help me.
I built a WordPress site working fine. The address is "http://mydomain.com" for example.
Then I would like to indicate "http://mydomain.com/data/" to /home/data/index.html .
So I modified the following /etc/nginx/default.d/locations.conf file.
$ cat locations.conf
location ~* /wp-config.php {
deny all;
}
# Beginning of Insertion this time
location /data/ {
root /home/data;
index index.html;
}
# End of Insertion this time
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}
$
After restarting nginx I accessed "http://mydomain.com/data/".
Then browser showed /usr/share/nginx/html/404.html file.
The permission and owner of /home/data/index.html is the following.
$ LANG=en ls -la /home/data
total 4
drwxrwxrwx 2 nginx nginx 24 Jan 5 11:52 .
drwxr-xr-x. 5 root root 42 Jan 5 11:37 ..
-rw-rw-r-- 1 nginx nginx 142 Dec 15 18:30 index.html
$
How should I write the configuration file?
Please help me.