Nginx安装
环境准备
1,centos 7.5
2,nginx-1.16.1.tar.gz
下载链接: http://nginx.org/en/download.html
稳定版本 table version nginx-1.16.1
安装部署
tar -zxvf nginx-1.16.1.tar.gz -C /usr/local/nginx/
cd /usr/local/nginx/nginx-1.16.1/
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
./configure --prefix=/usr/local/nginx/nginx-1.16.1 --with-http_stub_status_module --with-http_ssl_module
make
make install
vi /etc/rc.local
./nginx
ps -ef|grep nginx
详细步骤(包括异常处理)
[root@sentos local]
[root@sentos home]
apache-tomcat-8.5.53.tar.gz jdk-8u161-linux-x64.tar.gz mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz nginx-1.16.1.tar.gz redis-4.0.9.tar.gz
[root@sentos home]
[root@sentos home]
[root@sentos nginx]
nginx-1.16.1
[root@sentos nginx]
[root@sentos nginx]
[root@sentos nginx-1.16.1]
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@sentos nginx-1.16.1]
/usr/local/nginx/nginx-1.16.1
[root@sentos nginx-1.16.1]
[root@sentos nginx-1.16.1]
total 752
drwxr-xr-x 6 1001 1001 326 Apr 16 20:04 auto
-rw-r--r-- 1 1001 1001 296463 Aug 13 2019 CHANGES
-rw-r--r-- 1 1001 1001 452171 Aug 13 2019 CHANGES.ru
drwxr-xr-x 2 1001 1001 168 Apr 16 20:04 conf
-rwxr-xr-x 1 1001 1001 2502 Aug 13 2019 configure
drwxr-xr-x 4 1001 1001 72 Apr 16 20:04 contrib
drwxr-xr-x 2 1001 1001 40 Apr 16 20:04 html
-rw-r--r-- 1 1001 1001 1397 Aug 13 2019 LICENSE
-rw-r--r-- 1 root root 428 Apr 16 20:16 Makefile
drwxr-xr-x 2 1001 1001 21 Apr 16 20:04 man
drwxr-xr-x 3 root root 125 Apr 16 20:16 objs
-rw-r--r-- 1 1001 1001 49 Aug 13 2019 README
drwxr-xr-x 9 1001 1001 91 Apr 16 20:04 src
[root@sentos nginx-1.16.1]
[root@sentos nginx-1.16.1]
make -f objs/Makefile install
make[1]: Entering directory `/usr/local/nginx/nginx-1.16.1'
test -d '/usr/local/nginx/nginx-1.16.1' || mkdir -p '/usr/local/nginx/nginx-1.16.1'
test -d '/usr/local/nginx/nginx-1.16.1/sbin' \
|| mkdir -p '/usr/local/nginx/nginx-1.16.1/sbin'
test ! -f '/usr/local/nginx/nginx-1.16.1/sbin/nginx' \
|| mv '/usr/local/nginx/nginx-1.16.1/sbin/nginx' \
'/usr/local/nginx/nginx-1.16.1/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/nginx-1.16.1/sbin/nginx'
test -d '/usr/local/nginx/nginx-1.16.1/conf' \
|| mkdir -p '/usr/local/nginx/nginx-1.16.1/conf'
cp conf/koi-win '/usr/local/nginx/nginx-1.16.1/conf'
cp: ‘conf/koi-win’ and ‘/usr/local/nginx/nginx-1.16.1/conf/koi-win’ are the same file
make[1]: *** [install] Error 1
make[1]: Leaving directory `/usr/local/nginx/nginx-1.16.1'
make: *** [install] Error 2
[root@sentos nginx-1.16.1]
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README sbin src
[root@sentos nginx-1.16.1]
[root@sentos sbin]
nginx
[root@sentos sbin]
-bash: /pwd: No such file or directory
[root@sentos sbin]
/usr/local/nginx/nginx-1.16.1/sbin
[root@sentos sbin]
[root@sentos sbin]
touch /var/lock/subsys/local
/usr/local/redis/redis-4.0.9/conf/redis-server /usr/local/redis/redis-4.0.9/conf/redis.conf
/usr/local/nginx/nginx-1.16.1/sbin/nginx
[root@sentos sbin]
nginx
[root@sentos sbin]
nginx: [alert] could not open error log file: open() "/usr/local/nginx/nginx-1.16.1/logs/error.log" failed (2: No such file or directory)
2020/04/16 20:29:58 [emerg] 14428
[root@sentos sbin]
-bash: cd: /usr/local/nginx/nginx-1.16.1/logs: No such file or directory
[root@sentos sbin]
[root@sentos nginx-1.16.1]
auto CHANGES CHANGES.ru client_body_temp conf configure contrib fastcgi_temp html LICENSE Makefile man objs proxy_temp README sbin scgi_temp src uwsgi_temp
[root@sentos nginx-1.16.1]
[root@sentos nginx-1.16.1]
auto CHANGES CHANGES.ru client_body_temp conf configure contrib fastcgi_temp html LICENSE logs Makefile man objs proxy_temp README sbin scgi_temp src uwsgi_temp
[root@sentos nginx-1.16.1]
[root@sentos logs]
[root@sentos logs]
access.log error.log
[root@sentos logs]
/usr/local/nginx/nginx-1.16.1/logs
[root@sentos logs]
[root@sentos sbin]
nginx
[root@sentos sbin]
[root@sentos sbin]
root 14525 1 0 20:31 ? 00:00:00 nginx: master process ./nginx
nobody 14526 14525 0 20:31 ? 00:00:00 nginx: worker process
root 14535 6805 0 20:31 pts/0 00:00:00 grep --color=auto nginx