在官网上下载nginx,可以选中直接从ubuntu的源红直接安装:sudo apt-get install nginx。还有就是源码编译安装,我选择的是源码编译安装。具体的步骤如下:
ll /usr/local/src/
cp /home/hett/Downloads/nginx-1.9.8.tar.gz /usr/local/src/
cd /usr/local/src/
ll
tar -zxvf nginx-1.9.8.tar.gz
cd nginx-1.9.8/
ll
./configure && make && make instal
sudo apt-get install build-essential
sudo apt-get install libtool
sudo apt-get update
sudo apt-get install libpcre3 libpcre-dev
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install openssl
./configure --prefix=/usr/local/nginx
make
sudo make install
以上步骤就是完成安装了
启动nginx
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx默认的端口号是80,默认的地址的localhost/本机地址
通过localhost:80访问是否安装成功nginx
完成安装并安装成功