nginx redirects all requests to root

lists at lazygranch.com lists at lazygranch.com
Tue Jun 21 00:56:45 UTC 2022



On Mon, 20 Jun 2022 17:23:23 -0400
"_lukman_" <nginx-forum at forum.nginx.org> wrote:

> 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;
>    }

The mail wrapping makes this kind of confusing. From my own conf file
the root line is not within location. I believe this is what you want:

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
    root  /home/ubuntu/dummysite-ui/_work/dummysiteWebV1/dummysiteWebV1/build/web/;
    location /
    {
       index index.html index.php;
       # try_files $uri /index.html index.php;
    }

I put my webroot in /usr/share/nginx/html/website1

I have this line after the server_name:
ssl_dhparam /etc/ssl/certs/dhparam.pem;

Hopefully this works. If not wait for the gurus.








More information about the nginx mailing list