03 Oct NGINX: How to config domain subdirectory to point to a subfolder
Oct 3, 2020 – 2 min read
Description
Let’s say your website (e.g. mywebsite.com) is installed in the following directory on your server /var/www/mywebsite and you’d like to install a WordPress blog that can be accessed through the following URL mywebsite.com/blog.
You’ll have to configure NGINX to redirect users requests to a particular directory depending on the requested domain subfolder which in your case is mywebsite.com/blog.
There are two ways to do that.
The subfolder isn’t inside your main folder
The directory structure is the following.
Open your NGINX config file which should be located in /etc/nginx/sites-available/mywebsite and the following code (change it according to your needs).
Check for errors and reload the NGING configurations.
The subfolder is inside the main folder
The directory structure is the following.
Open your NGINX config file and the following code (change it according to your needs).
Check for errors and reload the NGING configurations.
If you need assistance contact me.