debian 9 - nginx 配置学习笔记
$ apt update
$ apt install nginx
这样就安装好了nginx,但是
版本
不一定是你想要的
这时直接访问80端口就看到nginx欢迎页面了
默认的配置文件/etc/nginx/sites-enabled/default
配置nginx
$ vim /etc/nginx/sites-enabled/default # 修改默认的配置或者删掉
若是删掉,则在
/etc/nginx/conf.d/
下新增.conf
文件,内容大致如下
server {
listen 80;
server_name www.vnnznn.cn;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl http2;
server_name www.vnnznn.cn;
charset utf-8;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_ecdh_curve secp384r1;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_session_tickets off;
ssl_certificate www.vnnznn.cn.crt;
ssl_certificate_key www.vnnznn.cn.key;
access_log /var/log/nginx/www.vnnznn.cn.access.log;
error_log /var/log/nginx/www.vnnznn.cn.error.log;
root /usr/share/nginx;
location / {
index index.html;
}
location /venn/zenn {
proxy_redirect off;
proxy_pass http://127.0.0.1:28935;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
免费证书申请: let’s encrypt
nginx拓展PCRE(Perl Compatible Regular Expressions),PHP