在ubuntu14.04上安装nginx1.10.1

环境:腾讯云ubuntu14.04 64位
步骤:
1:

解决
$ cd pcre-8.39
$ ./configure
报以下错误
configure: error: You need a C++ compiler for C++ support.
执行以下命令:
sudo apt-get install build-essential
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
$ tar -zxf pcre-8.39.tar.gz
$ cd pcre-8.39
$ ./configure
$ make
$ sudo make install

2:

$ wget http://zlib.net/zlib-1.2.8.tar.gz
$ tar -zxf zlib-1.2.8.tar.gz
$ cd zlib-1.2.8
$ ./configure
$ make
$ sudo make install

3

$ wget http://www.openssl.org/source/openssl-1.0.2f.tar.gz
$ tar -zxf openssl-1.0.2f.tar.gz
$ cd openssl-1.0.2f
$ ./config
$ make

这个时候装的时候不知道为什么多进行了这一步,反正没报错就不管了
sudo apt-get install openssl libssl-dev

$ sudo make install

4

$ wget http://nginx.org/download/nginx-1.10.1.tar.gz
$ tar zxf nginx-1.10.1.tar.gz
$ cd nginx-1.10.1
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-stream --with-stream_ssl_module --with-http_flv_module --with-http_mp4_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/usr/local/pcre-8.39 --with-zlib=/usr/local/zlib-1.2.8
make
sudo make install
  1. 启动 nginx
/usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.10.1

修改配置文件:
sudo vi /etc/nginx/nginx.conf

/usr/local/nginx/sbin/nginx

如果 nginx: [emerg] getpwnam("nginx") failed 执行一下面两行

useradd -s /sbin/nologin -M nginx
id nginx

应该会出现
uid=1000(nginx) gid=1000(nginx) 组=1000(nginx)

如果 nginx: [emerg] mkdir() "/var/tmp/nginx/client/" failed (2: No such file or directory) 执行下面两行

cd /var/tmp/
mkdir -p /var/tmp/nginx/{client,proxy,fastcgi,uwsgi,scgi}

再一次,没有任何提示就表示成功
/usr/local/nginx/sbin/nginx

你可能感兴趣的:(在ubuntu14.04上安装nginx1.10.1)