nginx配置多個站點的問題?
我用nginx配置兩個站點,一個站點要配置成https訪問,一個是http來訪問?
server {
<code> listen 443; server_name www.gzjjhd.com; ssl on; ssl_certificate E:/webserver/nginx/sslkey/wosign.com.crt; ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; location / { root E:/www/jsd; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root E:/www/jsd; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name app.gzjjhd.com; location / { root E:/www/HDWeb; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } include E:/www/HDWeb/rewrite.conf; location ~ \.php$ { root E:/www/HDWeb; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } </code>
我這樣配置完,app.gzjjhd.com 也變成 https://appgzjjhd.com 來訪問。但是我不要這樣。我要http://app.gzjjhd.com 請教各位大神如何修改!
回覆內容:
我用nginx配置兩個站點,一個站點要配置成https訪問,一個是http來訪問?
server {
<code> listen 443; server_name www.gzjjhd.com; ssl on; ssl_certificate E:/webserver/nginx/sslkey/wosign.com.crt; ssl_certificate_key E:/webserver/nginx/sslkey/wosign.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; location / { root E:/www/jsd; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root E:/www/jsd; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } server { listen 80; server_name app.gzjjhd.com; location / { root E:/www/HDWeb; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } include E:/www/HDWeb/rewrite.conf; location ~ \.php$ { root E:/www/HDWeb; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } </code>
我這樣配置完,app.gzjjhd.com 也變成 https://appgzjjhd.com 來訪問。但是我不要這樣。我要http://app.gzjjhd.com 請教各位大神如何修改!
分別用兩個站點設定檔
原來是我的443埠被佔用了
設定多個站點, 也就是虛擬主機的意思, 同一個server,載入多個站點, 在ngixn中設定虛擬主機,直接在主設定檔新增一個server{} 就可以了, 仿照他自帶的sever裡面的參數
<code>78 server { 79 listen 80; 80 # listen somename:8080; 81 server_name www.xuping.com; 82 root /usr/share/nginx/xuping; 83 index index.html index.htm; 84 85 location / { 86 try_files $uri $uri/ =404; 87 } 88 location ~ \.php$ { 89 fastcgi_split_path_info ^(.+\.php)(/.+)$; 90 # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 91 92 # With php5-cgi alone: 93 # fastcgi_pass 127.0.0.1:9000; 94 # # With php5-fpm: 95 fastcgi_pass unix:/var/run/php5-fpm.sock; 96 fastcgi_index index.php; 97 include fastcgi_params; 98 } 99 </code>
100 # deny access to .htaccess files, if Apache's document root
101 # concurs with nginx's one
102 #
103 location ~ /.ht {
102 #
}

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

PHP用於構建動態網站,其核心功能包括:1.生成動態內容,通過與數據庫對接實時生成網頁;2.處理用戶交互和表單提交,驗證輸入並響應操作;3.管理會話和用戶認證,提供個性化體驗;4.優化性能和遵循最佳實踐,提升網站效率和安全性。

PHP主要是過程式編程,但也支持面向對象編程(OOP);Python支持多種範式,包括OOP、函數式和過程式編程。 PHP適合web開發,Python適用於多種應用,如數據分析和機器學習。

PHP和Python各有優劣,選擇取決於項目需求和個人偏好。 1.PHP適合快速開發和維護大型Web應用。 2.Python在數據科學和機器學習領域佔據主導地位。

PHP適合網頁開發和快速原型開發,Python適用於數據科學和機器學習。 1.PHP用於動態網頁開發,語法簡單,適合快速開發。 2.Python語法簡潔,適用於多領域,庫生態系統強大。

PHP在數據庫操作和服務器端邏輯處理中使用MySQLi和PDO擴展進行數據庫交互,並通過會話管理等功能處理服務器端邏輯。 1)使用MySQLi或PDO連接數據庫,執行SQL查詢。 2)通過會話管理等功能處理HTTP請求和用戶狀態。 3)使用事務確保數據庫操作的原子性。 4)防止SQL注入,使用異常處理和關閉連接來調試。 5)通過索引和緩存優化性能,編寫可讀性高的代碼並進行錯誤處理。

可以通過以下步驟查詢 Docker 容器名稱:列出所有容器(docker ps)。篩選容器列表(使用 grep 命令)。獲取容器名稱(位於 "NAMES" 列中)。

PHP的核心優勢包括易於學習、強大的web開發支持、豐富的庫和框架、高性能和可擴展性、跨平台兼容性以及成本效益高。 1)易於學習和使用,適合初學者;2)與web服務器集成好,支持多種數據庫;3)擁有如Laravel等強大框架;4)通過優化可實現高性能;5)支持多種操作系統;6)開源,降低開發成本。

如何在 Windows 中配置 Nginx?安裝 Nginx 並創建虛擬主機配置。修改主配置文件並包含虛擬主機配置。啟動或重新加載 Nginx。測試配置並查看網站。選擇性啟用 SSL 並配置 SSL 證書。選擇性設置防火牆允許 80 和 443 端口流量。
