Guest User

Untitled

a guest
Jul 2nd, 2024
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. # nginx.conf
  2.  
  3. user root; # Ensure NGINX runs as root
  4.  
  5. events {
  6. worker_connections 1024;
  7. }
  8.  
  9. http {
  10. include /etc/nginx/mime.types;
  11. default_type application/octet-stream;
  12.  
  13. server {
  14. listen 80 default_server;
  15. listen [::]:80 default_server;
  16. server_name localhost;
  17.  
  18. root /var/www/html/;
  19. index index.php index.html;
  20.  
  21. # Support Yii2 pretty URL routing
  22. location / {
  23. try_files $uri $uri/ /index.php?$query_string;
  24. }
  25.  
  26. # Handle PHP scripts
  27. location ~ \.php$ {
  28. include fastcgi_params;
  29. fastcgi_pass php:9000;
  30. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  31. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  32. }
  33.  
  34. # Prevent additional HTTP methods
  35. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
  36. return 405;
  37. }
  38.  
  39. # Handle file uploads
  40. client_max_body_size 20M; # Adjust as per your upload size limit
  41. client_body_temp_path /var/www/html/uploads/temp;
  42. fastcgi_temp_path /var/www/html/uploads/fastcgi_temp;
  43.  
  44. location /uploads {
  45. internal;
  46. alias /var/www/html/uploads/;
  47. }
  48. }
  49. }
  50.  
Add Comment
Please, Sign In to add comment