Created
April 18, 2022 14:26
-
-
Save jimmy947788/a9a05f0a802af30c6d37507ecc895c87 to your computer and use it in GitHub Desktop.
Nginx 架設 Open Media Vault 使用的設定檔( 包和Certbot 憑證參數)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is auto-generated by openmediavault (https://www.openmediavault.org) | |
# WARNING: Do not edit this file, your changes will get lost. | |
server { | |
server_name nas.daedalus.cc; # managed by Certbot | |
root /var/www/openmediavault; #綁對應路徑 | |
index index.html; | |
autoindex off; | |
server_tokens off; | |
sendfile on; | |
large_client_header_buffers 4 32k; | |
client_max_body_size 25M; | |
error_log /var/log/nginx/openmediavault-webgui_error.log error; | |
access_log /var/log/nginx/openmediavault-webgui_access.log combined; | |
error_page 404 = $scheme://$host:$server_port/#/404; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~* \.json$ { | |
expires -1; | |
} | |
location ~* \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/run/php/php7.4-fpm-openmediavault-webgui.sock; | |
fastcgi_index index.php; | |
fastcgi_read_timeout 60s; | |
include fastcgi.conf; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PHP_ADMIN_VALUE session.cookie_secure=On; | |
} | |
if ($scheme = http) { | |
# Force redirection to HTTPS. | |
return 301 https://$host:443$request_uri; | |
} | |
listen *:443 ssl ; | |
listen [::]:443 ssl ; | |
ssl_certificate /etc/letsencrypt/live/nas.daedalus.cc/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/nas.daedalus.cc/privkey.pem; # managed by Certbot | |
include /etc/nginx/openmediavault-webgui.d/*.conf; | |
} | |
server { | |
if ($host = nas.daedalus.cc) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
server_name nas.daedalus.cc; | |
listen *:80 ; | |
listen [::]:80 ; | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment