Welcome! Log In Create A New Profile

Advanced

nginx redirects all requests to root

June 20, 2022 05:23PM
Hello Everyone.

My first post as I am new to this forum, as well as nginx.
I have an ecu instance where I host my files. I have a landing page placed in root and an admin area placed in /app folder. However, all requests somehow redirect to the root. My script is below. I dont know what I am doing wrong.

server
{
listen 443 default_server ssl;
listen [::]:443 ssl http2;
server_name dummysite.io www.dummysite.io;
ssl_certificate /etc/letsencrypt/live/dummysite.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dummysite.io/privkey.pem; # managed by Certbot
location /
{
root /home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
index index.html index.php;
# try_files $uri /index.html index.php;
}

error_log /var/log/nginx/dummysite.log;
access_log /var/log/nginx/dummysite.log;
}



server
{

listen 80;
server_name dummysite.io www.dummysite.io;
return 301 https://dummysite.io$request_uri;
charset utf-8;
root /home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
index index.html index.htm index.php;
# Always serve index.html for any request
location /
{
root /home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
# try_files $uri = index.html index.php;
}
return 301 https://dummysite.io$request_uri; # managed by Certbot
error_log /var/log/nginx/vue-app-error.log;
access_log /var/log/nginx/vue-app-access.log;
}

thank you in advance
Subject Author Posted

nginx redirects all requests to root

_lukman_ June 20, 2022 05:23PM

Re: nginx redirects all requests to root

gariac June 20, 2022 08:58PM

Re: nginx redirects all requests to root

_lukman_ June 21, 2022 03:59AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready