日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服

關于Nginx部署、配置的文章網上已經發布過很多,包括我自己也私藏了不少還發布過兩篇:

  • 后端必備 Nginx 配置
  • 前端必備 Nginx 配置

整理出來為的就是需要的時候,復制、粘貼就能使用。

然而千奇百怪的實際開發中,你肯定需要增刪Nginx配置。你就得上網搜一下,復制粘貼出bug了又得調一下...

搞定還得保存下來以備后患。多了不好找還得整理...就搞得很麻煩

后果

今天我給大家推薦一款"Nginx配置利器",配配變量就能一鍵生成常用配置。和繁瑣低效配置說再見

強大,Nginx配置一鍵生成

 

  • 網站鏈接:nginxconfig 在線配置網站
  • nginxconfig github項目

nginxconfig 目前支持:

  • Angular、React、Vue、Node.js
  • php、Python
  • wordPress/ target=_blank class=infotextkey>WordPress、Magento、Drupal
  • 緩存、Https、日志等各種配置...

使用

實現用戶訪問*.myweb.com域名自動跳轉到myweb.com配置,并且開啟http強制跳轉到https的配置。

強大,Nginx配置一鍵生成

 


強大,Nginx配置一鍵生成

 

配置完之后,下方還有安裝步驟指導你配置生效。交互體驗相當好

強大,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 redirect
server {
	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 redirect
server {
	listen 80;
	listen [::]:80;
	server_name .myweb.com;
	include nginxconfig.io/letsencrypt.conf;
	location / {
		return 301 https://myweb.com$request_uri;
	}
}


網站下方還羅列了推薦的nginx配置、安全配置...以作參考

/etc/nginx/nginx.conf

# Generated by nginxconfig.io
# https://nginxconfig.io/?0.domain=myweb.com&0.php=false&0.index=index.html&0.fallback_html
user www-data;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
	multi_accept on;
	worker_connections 65535;
}
http {
	charset utf-8;
	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	server_tokens off;
	log_not_found off;
	types_hash_max_size 2048;
	client_max_body_size 16M;
	# MIME
	include mime.types;
	default_type Application/octet-stream;
	# logging
	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log warn;
	# SSL
	ssl_session_timeout 1d;
	ssl_session_cache shared:SSL:10m;
	ssl_session_tickets off;
	# Diffie-Hellman parameter for DHE ciphersuites
	ssl_dhparam /etc/nginx/dhparam.pem;
	# Mozilla Intermediate configuration
	ssl_protocols TLSv1.2 TLSv1.3;
	ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
	# OCSP Stapling
	ssl_stapling on;
	ssl_stapling_verify on;
	resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
	resolver_timeout 2s;
	# load configs
	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}

/etc/nginx/nginxconfig.io/security.conf

# security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
# . files
location ~ /.(?!well-known) {
	deny all;
}

拓展

以上就滿足日常開發需求啦。如果你壓抑不住,想要展示你的高端操作。

你可以加入到項目本身開發中;nginxconfig項目本身是MIT開源協議,你也可以在此基礎上迭代出自己的版本

原文鏈接:https://juejin.im/post/5dbb88e56fb9a0208055c5fa

分享到:
標簽:配置 Nginx
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定