安裝nginx環(huán)境
安裝環(huán)境
yum install gcc
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel
在usr/local目錄下新建nginx文件夾
cd /usr/local
mkdir nginx
進入nginx文件夾
cd nginx
下載nginx的tar包
wget http://nginx.org/download/nginx-1.9.7.tar.gz
解壓tar
tar -zxvf nginx-1.9.7.tar.gz
安裝nginx
./configure
執(zhí)行make
make
執(zhí)行make install
make install
進入sbin
cd sbin
啟動
sudo ./nginx
查詢nginx.conf是否正確
/usr/local/nginx/sbin/nginx -t
部署靜態(tài)文件
cd nginx
vim conf/nginx.conf
server {
listen 80;
server_name _;
#root /usr/local/nginx/nginx-1.9.7/web/; # 靜態(tài)頁面根目錄
#index index.html;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/local/nginx/nginx-1.9.7/web/;
index index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
重啟:./sbin/nginx -s reload