#it's already in the http directive server { listen 2250; listen [::]:2250; root /root/www; add_header Access-Control-Allow-Origin * always; charset utf-8; location = / { index index.html; try_files $uri $uri/ =403; } location = /api.php { allow all; } location = /index.html { allow all; } location /assets/ { allow all; } location ~* \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location / { deny all; } error_page 405 =200 $uri; }