nginx安装

来源:互联网 发布:js实现dos窗口效果 编辑:程序博客网 时间:2024/06/04 00:23

nginx安装

我是在ubuntu上安装的
首先解压
tar -vxf nginx-1.3.1.tar.gz
然后进入解压后的文件夹
cd nginx-1.3.1/

然后执行./configure 命令生成makefile文件
此时可能会报如下的错误
./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.
这是由于没有安装pcre库造成的,然后执行以下命令安装pcre库

先更新一下源
sudo apt-get update             
然后安装pcre库
apt-get install libpcre3 libpcre3-dev

然后再执行./configure命令时可能会报错说没有安装zlib库,此时我们执行以下命令进行安装
apt-get install zlib1g-dev

然后执行./configure命令就能成功生成makefile文件了
然后编译
make
再安装
make install

安装完成后进入安装的文件夹,默认的安装文件夹是/usr/local/nginx/sbin
cd /usr/local/nginx/sbin
然后以管理员权限运行,然后就可以在浏览器中输入你的机器的ip,就会访问nginx的欢迎界面
sudo ./nginx
我是在虚拟机中安装的,然后用ifconfig命令查看一下虚拟机的IP,然后直接在主机的浏览器中输入虚拟机的IP就可以访问nginx的欢迎界面,当然在虚拟机中也能访问
0 0
原创粉丝点击