I have subdomain set up under Nginx and proxy passing to Apache to serve PHP files
Below is my config:
server { listen 80; server_name sub.domain.com.au; location ~* \.(css|js|jpg|jpeg|gif|png|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|docx|xlsx)$ { root /var/www/html/domain; index index.php; access_log off; expires 30d; } location / { proxy_pass http://10.1.11.34:8000; 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; client_max_body_size 8m; client_body_buffer_size 256k; proxy_connect_timeout 60; proxy_send_timeout 60; proxy_read_timeout 60; proxy_buffer_size 4k; proxy_buffers 32 256k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 256k; } }
It’s coming as 404 not found for static contents and I’m not sure why it’s happening as the root path is correct.
I’m getting 404 from Nginx error page
What could be wrong?
Answer
What does your request look like?
If you have http://sub.domain.com.au/images/my.jpg nginx will look for my.jpg in /var/www/html/domain/images/.
This path exists? Did you have a look at the logfiles?
Attribution
Source : Link , Question Author : Passionate Engineer , Answer Author : Ben.