Nginx 配置檔案2018-11 Centos 7.4
發表於 2018-11-11 19:18:30 by月小升
簡單配置
server { listen81; server_namejava-er.com; root/www/java-er.com; location / { index index.html index.htm index.php; } location ~ \.php$ { fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
Nginx SSl
sslon; ssl_certificate/www/javaer.com/ssl/full_chain.pem; ssl_certificate_key/www/javaer.com/ssl/private.key; ssl_session_timeout5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
if (!-e $request_filename){ rewrite (.*) /index.php; }
完整配置
server { listen80; listen443 ssl; #監聽兩個埠 server_namejava-er.com; root/www/javaer.com; ssl_certificate/www/javaer.com/ssl/full_chain.pem; ssl_certificate_key/www/javaer.com/ssl/private.key; location / { index index.html index.htm index.php; if (!-e $request_filename) { rewrite (.*) /blog/index.php; } } location ~ \.php$ { fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
ofollow,noindex">php-fpm 的理解
1. 客戶端通過http協議訪問網站域名
2. Nginx接受請求,並路由轉到index.php
3. 載入fastcgi模組
4. Fastcgi監聽127.0.0.1:9000地址
5. 然後訪問到達127.0.0.1:9000
6. php-fpm 監聽127.0.0.1:9000,也就接收到了請求
7. Fpm的master主程序,分配子程序去處理請求
8. 處理完成後,返回結果給 nginx
9. Nginx通過http協議響應給客戶端
- Centos7.4 nginx yum 自動升級php-fpm為php7
- 如何快取wordpress
- wordpress模板編寫外掛CSS丟失
- wordpress模板開發,判斷頁面型別
- wordpress 不用ftp更新系統和外掛
- wordpress忘記密碼
- nginx 在centos7.2下報Failed to restart nginx.service: Unit nginx.service failed to load:
- nginx 圖片上傳413 Request Entity Too Large
- centos 下 自己編譯php-fpm
- wordpress的$wpdb函式
- 為wordpress編寫一個外掛
- 負載均衡如何做,負載均衡的幾個方案
無特殊說明,文章均為月小升原創,歡迎轉載,轉載請註明本文地址,謝謝