linux 安装nginx服务器
下载nginx:http://nginx.org/en/download.html 将下载的安装包放到linux服务器上 解压安装包,{version}为版本号:
tar -zxvf nginx-{version}.tar.gz
cd nginx-{version}
编译,--prefix指定安装的目录:
./configure --prefix=/lym/server/nginx --with-http_stub_status_module --without-http-cache --with-http_ssl_module
make
make install
设置目录权限
chmod 775 /lym/server/nginx/logs
chmod -R 775 /lym/wwwroot
chmod 755 /lym/server/nginx/sbin/nginx
检查配置文件是否正确:
/lym/server/nginx/sbin/nginx -t
启动nginx:
/lym/server/nginx/sbin/nginx
重启nginx:
/lym/server/nginx/sbin/nginx -s reload
安装过程中相关问题解决方法---------------------------------------------------------------------
执行./configure命令错误: error: the HTTP rewrite module requires the PCRE library 解决方法:
yum -y install pcre-devel openssl openssl-devel
linux 64系统中安装nginx时如果出现错误:nginx: getpwnam(“www”) failed 解决方法1: 在nginx.conf中 把user nobody的注释去掉既可 解决方法2: 错误的原因是没有创建www这个用户,应该在服务器系统中添加www用户组和用户www,如下命令:
groupadd -f www
useradd -g www www