前因关于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、日志等各种配置...
文章插图
文章插图
配置完之后,下方还有安装步骤指导你配置生效 。交互体验相当好
文章插图
【教你如何一键生成Nginx配置,让配置不在繁琐】
生成配置
/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; }}
推荐阅读
- 如何选购薄荷茶,如何挑选和保持花草茶的秘诀
- 如何冲泡白牡丹,茉莉花茶如何喝
- 如何用养生壶煮花茶,甘草山楂茶原料和做法
- 贡菊怎么保存,如何保存花草茶
- 黑客“借刀杀人”,阿里 14 年经验安全大佬教你如何防御 DDoS 攻击
- 黑茶银耳减肥茶的效果,教你九个喝茶的技巧
- 华佗教你睡觉四个“戒律”,让你越来越年轻
- 熬夜严重可致死, 教你五招应对熬夜伤害
- 冲泡玫瑰花茶四大注意事项,四大步骤教你如何简易而快速的冲泡百合花茶
- 枸杞子泡红茶喝的害处,茉莉花茶如何喝