看板 Linux 關於我們 聯絡資訊
大家好,之前有在此版問過ssl設定,經過一週多後,還是設定失敗啊(崩潰 先說環境和設定: 1. NameVirtualHost有兩組 2. <VirtualHost>(略)</VirtualHost>一堆,有些用第一組NameVirtualHost,有些 用第二組 3. 申請的憑證作用是網站A跟網站B,兩個是用NameVirtualHost第一組 4. 443 port確定有開 5. 重開伺服器時(service httpd restart)有要求輸入PEM密碼,重開成功 以下最近的測試(因為怕影響到網站所以都是假日早起看比賽順便用伺服器,冠軍賽 是韓國內鬨R): 1. 把httpd.conf的NameVirtualHost都加上port (ip:80) 2. httpd.conf的<VirtualHost>裡頭的ServerName、ServerAlias都加上port(:80) 3. ssl.conf裡加上NameVirtualHost,同時加上port(ip:443) 4. ssl.conf裡設定兩組<VirtualHost>,就是網站A和網站B,同時加上port(:443), 裡頭的ServerName和ServerAlias也加上port(:443) 5. httpd.conf裡加上SSLEngine off 結果: 1. 重開伺服器後出現一大串錯誤 「ip:0 mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results」 那個ip就是NameVirtualHost那兩組。出現一大串後還是有要求輸入PEM密碼,重開成功。 2. 網站A的http和https共存,網站B的https存在,http被導到網站A,其他網站的http也 都被導到網站A了,不管是不是跟網站A用同一個ip,而https則是錯誤(code 400) 再次測試: 1. 把ssl.conf裡的NameVirtualHost註解掉,網站A和網站B的https存在,http 400 錯誤,其他用同ip的網站使用http也是400錯誤,另一個ip的網站http正常存在。 -----(分隔線)----- 各位真心救命RR,這個月週末斷斷續續用也用到快崩潰ORZ 目前想到最後解就是一個ip給SSL網站用,另一個給非SSL網站用orz 感謝各位 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.159.92.225 ※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1477275994.A.939.html
junorn: 把設定檔修改一下敏感資訊在丟上來看看會不會比較快? 10/24 11:39
OK httpd_conf_sample : ServerTokens OS ServerRoot "/(filepath)/httpd" PidFile run/httpd.pid Timeout 210 Listen MyipA:80 Listen MyipB:80 LoadModule (下略一堆module) # 這邊會載入ssl.conf Include (filepath))/*.conf ServerAdmin [email protected] ServerName aaa.com UseCanonicalName Off DocumentRoot "/var/www/aaa.com" AccessFileName .htaccess TypesConfig /(filepath))/mime.types DefaultType text/plain HostnameLookups Off EnableMMAP off ErrorLog logs/error_log LogLevel error ServerSignature On Alias /upload/ "/(filepath))/aaa.com/upload/" Alias /img319/ "/(filepath))/aaa.com/images/" Alias /icons/ "/(filepath))/icons/" Alias /error/ "/(filepath))/error/" <Directory "/(filepath))/aaa.com"> Order allow,deny Allow from all </Directory> TraceEnable off ServerName aaa NameVirtualHost MyipA:80 NameVirtualHost MyipB:80 SSLEngine off # # virtual host # <VirtualHost MyipA:80> SSLEngine off DocumentRoot /(filepath)/aaa.com ServerName www.aaa.com:80 ServerAlias aaa.com:80 ErrorLog logs/aaa.com-error_log </VirtualHost> <VirtualHost MyipB:80> DocumentRoot /(filepath)/www.ccc.com ServerName www.ccc.com:80 ServerAlias ccc.com:80 </VirtualHost> # (下略數十個都使用MyipB:80的VirtualHost,只有指向資料夾跟網址不一樣) <VirtualHost MyipA:80> SSLEngine off DocumentRoot /(filepath)/bbb.com/ ServerName www.bbb.com ServerAlias bbb.com ErrorLog logs/bbb.com-error_log <Directory "/(filepath)/bbb.com"> Options -Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost MyipA:80> DocumentRoot /(filepath)/folderA/ddd.com ServerName www.ddd.com:80 ServerAlias cn.ddd.com:80 ServerAlias ddd.com:80 ErrorLog logs/ddd.com-error_log </VirtualHost> # (下收一堆數十個用MyipA:80的設定) # (之後又收數十個用MyipB:80的設定) # 以上就是httpd.conf ssl_conf_sample : # This is ssl.conf sample LoadModule ssl_module modules/mod_ssl.so # 這邊忘記是用 Listen MyipA:443 + Listen MyipB:443 還是單純 Listen 443了抱歉 Listen 443 SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup file:/dev/urandom 256 SSLRandomSeed connect builtin #SSLRandomSeed startup file:/dev/random 512 #SSLRandomSeed connect file:/dev/random 512 #SSLRandomSeed connect file:/dev/urandom 512 SSLCryptoDevice builtin # 這邊的aaa跟httpd_sample的aaa一樣 ServerName aaa NameVirtualHost MyipA:443 NameVirtualHost MyipB:443 <VirtualHost MyipA:443> SSLEngine on SSLCertificateFile /(filepath)/certificateFile.cer SSLCertificateKeyFile /(filapath)/certificateKey.key <Directory /var/www/aaa.com> AllowOverride All </Directory> DocumentRoot /var/www/aaa.com ServerName www.aaa.com ServerAlias aaa.com ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn </VirtualHost> <VirtualHost MyipA:443> SSLEngine on SSLCertificateFile /(filepath)/certificateFile.cer SSLCertificateKeyFile /(filapath)/certificateKey.key <Directory /var/www/bbb.com> AllowOverride All </Directory> DocumentRoot /var/www/bbb.com ServerName www.bbb.com ServerAlias bbb.com ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn </VirtualHost> # 以上就是ssl.conf檔範例 ※ 編輯: chaos012 (49.159.92.225), 10/24/2016 14:09:15