VPS Nginx 简明使用指南

/

160528-0001

安装

wget http://nginx.org/download/nginx-1.10.0.tar.gz

tar xvzf nginx-1.10.0.tar.gz

cd nginx-1.10.0

./configure –prefix=/usr/local/nginx

yum install pcre*

make

make install

检查是否安装成功

cd  /usr/local/nginx/sbin

./nginx -t

使用

* 启动nginx:/usr/local/nginx/sbin/nginx

* 停止nginx:/usr/local/nginx/sbin/nginx -s stop

* 修改nginx配置:cd /usr/local/nginx/conf,vi nginx.conf

PS: 修改保存,记得要重启。

配置示例

cd /usr/local/nginx/conf

vi nginx.conf

server {

listen       9615;

server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {

root   /www/web/;

index  index.html index.htm;

}

}

PS:网站相关文件最好不要放在某个用户目录下,因为可能会产生一些权限问题。

Tags: , , Categorised in: This post was written by PopVPS

Comments are closed here.