前言:
而今咱们对“nginx的root目录权限问题”大约比较注重,咱们都想要学习一些“nginx的root目录权限问题”的相关文章。那么小编在网上收集了一些关于“nginx的root目录权限问题””的相关文章,希望你们能喜欢,姐妹们快快来了解一下吧!1、第一步:获取nginx的安装包
wget
2、解压安装包
tar -xvf nginx-1.7.8.tar.gz
3、执行./configure --prefix=/usr/local/nginx命令报如下错误
报错:./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
解决之法:
yum -y install pcre-devel
4、执行./configure --prefix=/usr/local/nginx命令报如下错误
报错:./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
解决之法:
yum -y install pcre-devel openssl openssl-devel
5、执行如下命令:
./configure --prefix=/usr/local/nginx
6、执行如下命令:
make
7、执行如下命令:
make install
8、启动nginx
启动代码格式:nginx安装目录地址 -c nginx配置文件地址
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
9、访问nginx
curl nginx所在后台的IP地址:端口(默认80)
eg:
表示nginx安装成功
10、强制停止nginx
pkill -9 nginx
11、更改nginx的端口
修改配置文件路径:/usr/local/nginx/conf/nginx.conf
修改为你需要的端口:
重启nginx生效
12、同一linux后台安装多个nginx服务
1)重复步骤5
./configure --prefix=/usr/local/nginx2
ps:prefix必须指定新的nginx安装目录
2)执行:make && make install
3)修改配置文件如下3个地方
(1)赋予root权限,在nginx.conf开头增加如下内容:
(2)修改访问端口
(3)修改访问路径
4)启动nginx
/usr/local/nginx2/sbin/nginx -c /usr/local/nginx2/conf/nginx.conf