Znfeoqm commited on
Commit
22c621b
·
verified ·
1 Parent(s): fa8022e

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +15 -2
nginx.conf CHANGED
@@ -2,7 +2,7 @@ user nginx;
2
  worker_processes auto;
3
 
4
  error_log /dev/stderr warn;
5
- pid /tmp/nginx.pid;
6
 
7
  events {
8
  worker_connections 1024;
@@ -32,5 +32,18 @@ http {
32
  uwsgi_temp_path /tmp/uwsgi_temp;
33
  scgi_temp_path /tmp/scgi_temp;
34
 
35
- include /etc/nginx/conf.d/*.conf;
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
 
2
  worker_processes auto;
3
 
4
  error_log /dev/stderr warn;
5
+ pid /tmp/nginx.pid; # PID file moved to /tmp for permissions
6
 
7
  events {
8
  worker_connections 1024;
 
32
  uwsgi_temp_path /tmp/uwsgi_temp;
33
  scgi_temp_path /tmp/scgi_temp;
34
 
35
+ # This is the crucial server block for your React application
36
+ server {
37
+ listen 8080; # Nginx will listen on port 8080, which is typically allowed for non-root users
38
+ root /usr/share/nginx/html; # This is where your built React app files are located
39
+ index index.html index.htm; # Default files to serve if a directory is requested
40
+
41
+ # This location block is essential for Single-Page Applications (SPAs) like React.
42
+ # It tries to serve the requested file ($uri), then a directory ($uri/),
43
+ # and if neither is found, it falls back to serving index.html.
44
+ # This allows React's client-side routing to work correctly.
45
+ location / {
46
+ try_files $uri $uri/ /index.html;
47
+ }
48
+ }
49
  }