Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # nginx.conf
- user root; # Ensure NGINX runs as root
- events {
- worker_connections 1024;
- }
- http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- server {
- listen 80 default_server;
- listen [::]:80 default_server;
- server_name localhost;
- root /var/www/html/;
- index index.php index.html;
- # Support Yii2 pretty URL routing
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- }
- # Handle PHP scripts
- location ~ \.php$ {
- include fastcgi_params;
- fastcgi_pass php:9000;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param SCRIPT_NAME $fastcgi_script_name;
- }
- # Prevent additional HTTP methods
- if ($request_method !~ ^(GET|HEAD|POST)$ ) {
- return 405;
- }
- # Handle file uploads
- client_max_body_size 20M; # Adjust as per your upload size limit
- client_body_temp_path /var/www/html/uploads/temp;
- fastcgi_temp_path /var/www/html/uploads/fastcgi_temp;
- location /uploads {
- internal;
- alias /var/www/html/uploads/;
- }
- }
- }
Add Comment
Please, Sign In to add comment