memperbaiki docker manifests

This commit is contained in:
2024-07-19 11:13:43 +07:00
parent f0ce269594
commit e28a247ab8
10 changed files with 223 additions and 149 deletions

View File

@@ -1,37 +1,82 @@
server {
listen 80 default_server;
index index.php index.html;
root /app;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# set client body size#
client_max_body_size 8M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
try_files $uri $uri/ /index.php;
if (!-e $request_filename){
rewrite ^/admin/(.*)$ /admin/index.php?/$1? last;
rewrite ^/api/(.*)$ /api/index.php?/$1? last;
rewrite ^/webhook/(.*)$ /webhook/index.php?/$1? last;
rewrite ^/(.*)$ /index.php?/$1? last;
}
location ~* \.(jpe?g|gif|png|bmp|ico|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$ {
access_log off;
log_not_found off;
try_files $uri $uri/ $document_root$uri /index.php?$args;
expires 1w;
}
server {
listen 80 default_server;
index index.php index.html;
root /app;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# set client body size#
client_max_body_size 8M;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_buffers 4 4096k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 3000s;
fastcgi_send_timeout 3000s;
fastcgi_read_timeout 3000s;
}
# try_files $uri $uri/ /index.php;
# if (!-e $request_filename){
# rewrite ^/admin/(.*)$ /admin/index.php?/$1? last;
# rewrite ^/api/(.*)$ /api/index.php?/$1? last;
# rewrite ^/(.*)$ /index.php?/$1? last;
# }
location ~* \.(jpe?g|gif|png|bmp|ico|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$ {
access_log off;
log_not_found off;
try_files $uri $uri/ $document_root$uri /index.php?$args;
expires 1w;
}
location ~ /\. {
access_log denied;
log_not_found off;
deny all;
}
}

View File

@@ -1,27 +1,60 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main buffer=16k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Timeout limit values
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 13;
send_timeout 10;
# Buffer size
client_body_buffer_size 80k;
client_max_body_size 9m;
client_header_buffer_size 1k;
# Gzip compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# config from simrs
# client_max_body_size 1500M;
# client_body_buffer_size 64M;
# keepalive_timeout 900;
include /etc/nginx/conf.d/*.conf;
# File Cache Opening
open_file_cache max=1024 inactive=10s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
#footer
}