Files
pack/core/providers/php/nginx.template.conf
T

75 lines
1.9 KiB
Plaintext

worker_processes 5;
daemon off;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /dev/stdout;
error_log /dev/stdout;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server {
listen 0.0.0.0:80;
listen [::]:80;
server_name localhost;
{{if .RAILPACK_PHP_ROOT_DIR}}
root {{.RAILPACK_PHP_ROOT_DIR}};
{{else}}
root /app;
{{end}}
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
{{if .IS_LARAVEL}}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
{{end}}
{{if .RAILPACK_PHP_FALLBACK_PATH}}
location / {
try_files $uri $uri/ {{.RAILPACK_PHP_FALLBACK_PATH}}?$query_string;
}
{{end}}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
{{if .IS_LARAVEL}}
error_page 404 /index.php;
{{end}}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:12345;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
include /etc/nginx/fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
}