关于Nginx部署、配置的文章网上已经发布过很多,包括我自己也私藏了不少还发布过两篇:
- 后端必备 Nginx 配置
- 前端必备 Nginx 配置
然而千奇百怪的实际开发中,你肯定需要增删Nginx配置 。你就得上网搜一下,复制粘贴出bug了又得调一下...
搞定还得保存下来以备后患 。多了不好找还得整理...就搞得很麻烦
后果今天我给大家推荐一款"Nginx配置利器",配配变量就能一键生成常用配置 。和繁琐低效配置说再见
文章插图
- 网站链接:nginxconfig 在线配置网站
- nginxconfig github项目
- Angular、React、Vue、Node.js
- php、Python
- wordPress/ target=_blank class=infotextkey>WordPress、Magento、Drupal
- 缓存、Https、日志等各种配置...
文章插图
文章插图
配置完之后,下方还有安装步骤指导你配置生效 。交互体验相当好
文章插图
生成配置 /etc/nginx/sites-available/myweb.com.conf 如下:
server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name myweb.com; root /var/www/myweb.com/public; # SSL ssl_certificate /etc/letsencrypt/live/myweb.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/myweb.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/myweb.com/chain.pem; # security include nginxconfig.io/security.conf; # index.html fallback location / {try_files $uri $uri/ /index.html; } # additional config include nginxconfig.io/general.conf;}# subdomains redirectserver { listen 443 ssl http2; listen [::]:443 ssl http2; server_name *.myweb.com; # SSL ssl_certificate /etc/letsencrypt/live/myweb.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/myweb.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/myweb.com/chain.pem; return 301 https://myweb.com$request_uri;}# HTTP redirectserver { listen 80; listen [::]:80; server_name .myweb.com; include nginxconfig.io/letsencrypt.conf; location / {return 301 https://myweb.com$request_uri; }}
推荐阅读
- 华为交换机配置用户级别
- 动态路由协议之OSPF简介及单区域基本配置
- linux配置samba服务
- 代码示例 PHP如何使用phpinfo获取PHP配置信息?
- Nginx 下关于缓存控制字段 cache-control 的配置说明
- IntelliJ IDEA 最常用配置详细图解,新手入门必看
- 磁盘分区对齐详解与配置
- 五个案例“熄灭”Nginx漏洞隐患
- nginx正向https代理配置
- Nginx + Tomcat + Redis 架构的负载均衡及会话保持