服務安裝
通過rpm包安裝
壓縮包nginx-1.14.0.tar.gz解壓
進入目錄nginx-1.14.0
編輯文件nginx-1.14.0/auto/cc/gcc :
註釋掉171和172行:
解決依賴性
yum install gcc pcre-devel openssl-devel -y
安裝
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads --with-file-aio
沒有報錯後執行make make install
2 配置文件
nginx打開服務
編輯nginx的配置文件/usr/local/nginx/conf/nginx.conf :
第3行設定進程數爲2,第4行指定工作cpu關係爲01 10
18行寫apache的工作組,爲兩個服務器
創建nginx用戶nginx:useradd -M -d /usr/local/nginx nginx
在limits.conf中限制用戶
nginx -s reload 重新加載配置文件
兩臺rsa服務器打開httpd服務
在瀏覽器所在主機增加解析 172.25.15.7 www.westos.org
測試結果
nginx服務的默認發佈目錄爲/usr/local/nginx/html。
在這個目錄裏寫入測試文件test.html。
在配置文件/usr/local/nginx/conf/nginx.conf中,將VS以備份的形式寫入wetsos組:
在nginx的默認發佈目錄下,將原有的index.html文件移動到其他目錄中,將新建的test.html文件重命名爲index.html。之後 重新加載nginx服務。這樣,在兩個RS服務都停掉的情況下,解析www.westos.org域名就可以解析到VS端的內容,可以在這個新建的 index.html文件中寫入該網站正在維護等相關信息,表示後臺服務器無法提供正常服務:
3 cookies
對nginx重新配置
關閉舊nginx
打開瀏覽器 f12 添加stronge 可以看到cookies信息