Skip to content

Instantly share code, notes, and snippets.

@PhongGCS
Created July 22, 2024 16:41
Show Gist options
  • Save PhongGCS/a5eec32fb0098cbd50446cd53d7f261a to your computer and use it in GitHub Desktop.
Save PhongGCS/a5eec32fb0098cbd50446cd53d7f261a to your computer and use it in GitHub Desktop.
s3cloud.asia minio nginx
server
{
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen [::]:80;
server_name s3cloud.asia;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/s3cloud.asia;
#CERT-APPLY-CHECK--START
# Configuration related to file verification for SSL certificate application - Do not delete
# include /www/server/panel/vhost/nginx/well-known/s3cloud.asia.conf;
#CERT-APPLY-CHECK--END
#SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/s3cloud.asia/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/s3cloud.asia/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START Error page configuration, allowed to be commented, deleted or modified
error_page 404 /404.html;
error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP reference configuration, allowed to be commented, deleted or modified
include enable-php-82.conf;
#PHP-INFO-END
#REWRITE-START URL rewrite rule reference, any modification will invalidate the rewrite rules set by the panel
# include /www/server/panel/vhost/rewrite/s3cloud.asia.conf;
# Proxy requests to the bucket "photos" to Minio server running on port 9000
location /admin/ {
rewrite ^/admin/(.*)$ /$1 break;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
# This is necessary to pass the correct IP to be hashed
real_ip_header X-Real-IP;
proxy_connect_timeout 300;
# To support websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
chunked_transfer_encoding off;
proxy_pass http://localhost:9011; # This uses the upstream directive definition to load balance
# This one rewrite with sub_filter plugin
sub_filter '<base href="/"/>' '<base href="/minio/ui/"/>';
}
# Proxy any other request to the application server running on port 9001
location / {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
tcp_nodelay on;
proxy_pass http://localhost:9010;
}
#REWRITE-END
access_log /www/wwwlogs/s3cloud.asia.log;
error_log /www/wwwlogs/s3cloud.asia.error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment