Hello, I’ve been trying to install the wordpress on Subdirectory of my website.
Any can guide which steps should i follow to make it work?
I am using ubuntu 22.04 Lts. LEMP is installed.
At the moment i am following these steps: 1- created /blog directory on root domain. 2- created a .conf file in /etc/nginx/sites-avaiable with below code
server {
root /var/www/html/websiterootfolder/blog;
index index.php index.html index.htm index.nginx-debian.html;
server_name bestchairsreviews.com www.bestchairsreviews.com;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
}
#location /blog {
# index index.php index.html index.htm;
# try_files $uri $uri/ /index.php?$args;
#}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
3- created database and user 4- Installed PHP extensions 5- restarted apache with this:
sudo systemctl restart apache2;
6- Enabled the /etc/nginx/sites-enabled
Also i followed few tutorials but after that i am getting 404 or 403 errors.
Tutorial i already tried: www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-20-04-with-a-lamp-stack
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
Your website seems to be loading as expected already. Do you have a separate website that is installed in
/var/www/yourdomain
and should WordPress be only loading for the/blog
URL?If you already have a website setup on that server for this domain name, you would usually not want to add a totally separate Nginx server block but just add the necessary rules for the WordPress installation, for example:
In this example, requests to
example.com/blog
will be served from the/var/www/yoursite/blog
directory, and requests toexample.com/
will be served from the/var/www/yoursite
directory.An alternative approach is to use a separate Nginx server block with a subdomain like
blog.yourdomain.com
.Best,
Bobby