您好,登錄后才能下訂單哦!
這篇文章主要講解了“Nginx怎么配置在線(xiàn)一鍵生成神器”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“Nginx怎么配置在線(xiàn)一鍵生成神器”吧!
NGINX Config 支持 HTTP、HTTPS、PHP、Python、Node.js、WordPress、Drupal、緩存、逆向代理、日志等各種配置選項(xiàng)。在線(xiàn)生成 Web 服務(wù)器 Nginx 配置文件。
操作配置也非常簡(jiǎn)單,你需要做的只需要2步:
打開(kāi)官方網(wǎng)站
按需求配置相關(guān)參數(shù)
系統(tǒng)就會(huì)自動(dòng)生成特定的配置文件。雖然界面是英文的,但是功能的頁(yè)面做的非常直觀,生成的Nginx格式規(guī)范。
登陸之后大概的界面如下:
案例展示
配置域名:mingongge.com 實(shí)現(xiàn)用戶(hù)訪問(wèn)*.mingongge.com 域名時(shí)會(huì)自動(dòng)跳轉(zhuǎn)到 mingongge.com 此配置,并且開(kāi)啟http強(qiáng)制跳轉(zhuǎn)到https的配置。
這時(shí),Nginx的配置就會(huì)實(shí)時(shí)自動(dòng)生成在下面,我把生成的配置復(fù)制過(guò)來(lái),如下:
/etc/nginx/sites-available/mingongge.com.conf #文件名都給你按規(guī)則配置好了 server { listen 443 ssl http2; server_name mingongge.com; # SSL ssl_certificate /etc/letsencrypt/live/mingongge.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mingongge.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/mingongge.com/chain.pem; # security include nginxconfig.io/security.conf; # additional config include nginxconfig.io/general.conf; } # subdomains redirect server { listen 443 ssl http2; server_name *.mingongge.com; # SSL ssl_certificate /etc/letsencrypt/live/mingongge.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mingongge.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/mingongge.com/chain.pem; return 301 https://mingongge.com$request_uri; } # HTTP redirect server { listen 80; server_name .mingongge.com; include nginxconfig.io/letsencrypt.conf; location / { return 301 https://mingongge.com$request_uri; } }
非常的方便與快速。
官方還提供一些Nginx的基礎(chǔ)優(yōu)化配置,如下:
/etc/nginx/nginx.conf # Generated by nginxconfig.io 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; # 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 * data: 'unsafe-eval' 'unsafe-inline'" always; # . files location ~ /\.(?!well-known) { deny all; }
都相當(dāng)于是提供一些基礎(chǔ)的模板配置,可以根據(jù)自己的實(shí)際需求去修改。
感謝各位的閱讀,以上就是“Nginx怎么配置在線(xiàn)一鍵生成神器”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)Nginx怎么配置在線(xiàn)一鍵生成神器這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。