Linux环境
首先要先进行Nginx安装,解压linux-nginx-1.10.2.tar.gz
在目录执行./configure
然后在执行make, make install命令,查看/usr/local/文件夹下有没有nginx,有则安装成功
执行sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf启动nginx
输入localhost看见以下界面说明启动成功
如果报错:nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
原因可能是:当前用户对该位置没有写入权限
解决办法:
使用命令:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 以root权限启动报./configure: error: the HTTP rewrite module requires the PCRE library.
需要安装pcre-devel
yum -y install pcre-devel
yum -y install openssl openssl-devel
Windows环境安装
- Windows下安装操作很简单
windows 系统下,只需将安装包解压,然后进入解压后的文件夹nginx
双击nginx.exe启动
输入localhost看见以下界面说明启动成功