nginx安裝,默認主機配置,Nginx用戶認證,Nginx域名重定向
阿新 • • 發佈:2018-03-14
nginx安裝默認主機配置Nginxnginx安裝
cd /usr/local/src
wget http://220.112.193.202/files/302100000569FBE9/nginx.org/download/nginx-1.12.2.tar.gz
解壓到/usr/local/nginx
./configure --prefix=/usr/local/nginx
make make install
編輯配置文件
vim /etc/init.d/nginx,內容使用https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/etc_init.d_nginx
修改啟動文件權限,加入到chkconfig服務列表中
![技術分享圖片](http://i2.51cto.com/images/blog/201803/13/47e9fb515e2b1ee6f77e3fa5d441f868.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
cd /usr/local/nginx/conf/; mv nginx.conf nginx.conf.bak
vim nginx.conf //寫入如下內容(參考https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/nginx.conf)
/usr/local/nginx/sbin/nginx -t
/etc/init.d/nginx start
netstat -lntp |grep 80
測試:1.解析本地localhost沒問題
![技術分享圖片](http://i2.51cto.com/images/blog/201803/14/3c49a03516e53d0ff3e239d30f277906.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
2.vi /usr/local/nginx/html/1.php //加入如下內容
<?php
echo "test php scripts.";
?>
curl localhost/1.php
cd /usr/local/src
wget http://220.112.193.202/files/302100000569FBE9/nginx.org/download/nginx-1.12.2.tar.gz
解壓到/usr/local/nginx
./configure --prefix=/usr/local/nginx
make make install
編輯配置文件
vim /etc/init.d/nginx,內容使用https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D15Z/etc_init.d_nginx
修改啟動文件權限,加入到chkconfig服務列表中
![技術分享圖片](http://i2.51cto.com/images/blog/201803/13/47e9fb515e2b1ee6f77e3fa5d441f868.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
cd /usr/local/nginx/conf/; mv nginx.conf nginx.conf.bak
/usr/local/nginx/sbin/nginx -t
/etc/init.d/nginx start
netstat -lntp |grep 80
測試:1.解析本地localhost沒問題
![技術分享圖片](http://i2.51cto.com/images/blog/201803/14/3c49a03516e53d0ff3e239d30f277906.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
2.vi /usr/local/nginx/html/1.php //加入如下內容
<?php
echo "test php scripts.";
?>
curl localhost/1.php
![技術分享圖片](http://i2.51cto.com/images/blog/201803/14/b9b30361cb39dbabd4699ab3a648b4cf.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
暫時還沒得到答案。。。。 nginx 默認主機
nginx安裝,默認主機配置,Nginx用戶認證,Nginx域名重定向