map $sent_http_content_type $expires { "text/html" epoch; "text/html; charset=utf-8" epoch; default off; } server { listen 80; server_name lorem.io www.lorem.io; root /home/joedoe/Documents/projects/MY_PROJECT/backend/public; index index.html index.htm index.php; location /api/ { root /home/joedoe/Documents/projects/MY_PROJECT/backend/public; try_files $uri /index.php$is_args$args; } location / { expires $expires; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 1m; proxy_connect_timeout 1m; proxy_pass http://localhost:3000; # set the address of the Node.js instance here #try_files $uri /index.html; } location ~ \.php$ { fastcgi_pass unix:/run/php/php8.1-fpm.sock; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; #include fastcgi_params; include snippets/fastcgi-php.conf; } location ~ /\.ht { deny all; } }