4.8 KiB
4.8 KiB
nginx
重启
service nginx restart
配置https
server {
#SSL 访问端口号为 443
listen 443;
#填写绑定证书的域名
server_name qr.powerrain.cn;
#启用 SSL 功能
ssl on;
#证书文件名称
ssl_certificate 1_qr.powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_qr.powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照这个套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
#网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
#root /var/www/www.domain.com;
#index index.html index.htm;
proxy_pass https://flask/; #这里面的最后的斜杠一定不能少
}
}
upstream flask{
server 0.0.0.0:5000;
}
极简印的nginx配置备份
server {
listen 80;
server_name qr.powerrain.cn;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /data/wwwroot;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root /usr/share/nginx/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~ \.php$ {
root /data/wwwroot;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#location /qrcode {
# proxy_pass 0.0.0.0:5000;
#}
}
server {
#SSL 访问端口号为 443
listen 443 ssl http2; #填写绑定证书的域名
server_name qr.powerrain.cn;
#证书文件名称
ssl_certificate 1_qr.powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_qr.powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照这个套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
server {
listen 80 http2;
server_name powerrian.cn;
location / {
root /data/wwwroot;
index index.html index.htm;
}
}
server {
listen 80 http2;
server_name www.powerrian.cn;
location / {
root /data/wwwroot;
index index.html index.htm;
}
}
精简一下
server {
listen 80;
server_name qr.powerrain.cn;
location / {
root /data/wwwroot;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
location ~ \.php$ {
root /data/wwwroot;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
#SSL 访问端口号为 443
listen 443 ssl http2; #填写绑定证书的域名
server_name qr.powerrain.cn;
#证书文件名称
ssl_certificate 1_qr.powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_qr.powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照这个套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
server {
listen 80 http2;
server_name powerrian.cn;
location / {
root /data/wwwroot;
index index.html index.htm;
}
}
server {
listen 80 http2;
server_name www.powerrian.cn;
location / {
root /data/wwwroot;
index index.html index.htm;
}
}