Im trying to configure a website as a sub location of another website. For more context, i have wp1 and wp2, both wordpress sites, and wp2 needs to be a sub location of wp1, like http://wp1.com/wp2 but i cant find the way to actually do it, i read the avaliable documentation but still cant find why this isnt actually working.
My nginx configuration file:
server {
listen 80;
listen [::]:80 ;
server_name 1.2.3.4; #(IP)
root /var/www/html/wp1;
index index.php;
client_max_body_size 200M;
satisfy any;
allow 1.2.3.4;
deny all;
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
location /wp2 {
root /var/www/html/wp2;
index index.php;
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}