0

I put the files of my React build in: root/website.com/site/public.

My /etc/nginx/sites-available/default:

server {
    listen 80 default_server;
    root /root/website.com/site/public/;
    server_name 00.000.00.000; 
    index index.html index.htm;
    location / {
            try_files $uri $uri/ =404;
    }
}

I get a bad gateway error when I go to my ip address. Do I need to run npm start to get my index.html to show up?

For some reason when I run npm start it searches for index.html in /site/src then if I change the name of public to src it searches in site/public.

4

1 Answer 1

0

Using /root/website.com/site/public was unreachable by nginx apparently. Changed it to the typical /var/www/website/site/public and moved my build file there and it worked.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.