mirror of
https://github.com/Encryptshell/Pritunl-API-crack.git
synced 2025-11-29 08:33:10 +00:00
Add nginx conf to use this via nginx+php-fpm
This adds nginx.conf (not only `server` block! use whatever suits best) to allow running the API server using nginx+fpm. this is adapted from https://github.com/TrafeX/docker-php-nginx
This commit is contained in:
85
www/nginx.conf
Normal file
85
www/nginx.conf
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
worker_processes auto;
|
||||||
|
error_log stderr warn;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
# Define custom log format to include reponse times
|
||||||
|
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
||||||
|
'$request_time $upstream_response_time $pipe $upstream_cache_status';
|
||||||
|
|
||||||
|
access_log /dev/stdout main_timed;
|
||||||
|
error_log /dev/stderr notice;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
# Write temporary files to /tmp so they can be created as a non-privileged user
|
||||||
|
client_body_temp_path /tmp/client_temp;
|
||||||
|
proxy_temp_path /tmp/proxy_temp_path;
|
||||||
|
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||||
|
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||||
|
scgi_temp_path /tmp/scgi_temp;
|
||||||
|
|
||||||
|
# Default server definition
|
||||||
|
server {
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
sendfile off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
absolute_redirect off;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
index index.php index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to index.php
|
||||||
|
try_files $uri $uri/ /index.php?path=$uri&$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pass the PHP scripts to PHP-FPM listening on php-fpm.sock
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass unix:/run/php-fpm.sock;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
|
||||||
|
expires 5d;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Deny access to . files, for security
|
||||||
|
location ~ /\. {
|
||||||
|
log_not_found off;
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hardening
|
||||||
|
proxy_hide_header X-Powered-By;
|
||||||
|
fastcgi_hide_header X-Powered-By;
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
|
||||||
|
# Include other server configs
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user