安装nginx
Posted 细语细语
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装nginx相关的知识,希望对你有一定的参考价值。
root@liuhan888:/home/liuhan168# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
root@liuhan888:/home/liuhan168# apt-get install build-essential root@liuhan888:/home/liuhan168# apt-get install libtool root@liuhan888:/home/liuhan168/docment# mkdir toolstonginx root@liuhan888:/home/liuhan168/docment# cd toolstonginx/ root@liuhan888:/home/liuhan168/docment/toolstonginx# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.23.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx# tar -zxf pcre2-10.23.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx# cd pcre2-10.23 root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre2-10.23# ./configure root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre2-10.23# make root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre2-10.23# make install root@liuhan888:/home/liuhan168/docment/toolstonginx# wget http://zlib.net/zlib-1.2.11.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx/zlib-1.2.11# ./configure root@liuhan888:/home/liuhan168/docment/toolstonginx/zlib-1.2.11# make root@liuhan888:/home/liuhan168/docment/toolstonginx/zlib-1.2.11# make install root@liuhan888:/home/liuhan168/docment/toolstonginx# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx# tar -zxvf openssl-1.0.2l.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx/openssl-1.0.2l# cat INSTALL root@liuhan888:/home/liuhan168/docment/toolstonginx/openssl-1.0.2l# ./config root@liuhan888:/home/liuhan168/docment/toolstonginx/openssl-1.0.2l# make root@liuhan888:/home/liuhan168/docment/toolstonginx/openssl-1.0.2l# make install root@liuhan888:/home/liuhan168/docment/toolstonginx# wget http://nginx.org/download/nginx-1.12.0.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# ./configure --sbin-path=/usr/local/nginx/nginx \\ > --conf-path=/usr/local/nginx/nginx.conf \\ > --pid-path=/usr/local/nginx/nginx.pid \\ > --with-http_ssl_module \\ > --with-pcre=/opt/app/openet/oetal1/chenhe/pcre2-10.23-8.39 \\ > --with-zlib=/opt/app/openet/oetal1/chenhe/zlib-1.2.11 \\ > --with-openssl=/opt/app/openet/oetal1/chenhe/openssl-1.0.2l root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# make make -f objs/Makefile make[1]: Entering directory \'/home/liuhan168/docment/toolstonginx/nginx-1.12.0\' cd /opt/app/openet/oetal1/chenhe/pcre2-10.23 \\ && if [ -f Makefile ]; then make distclean; fi \\ && CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \\ ./configure --disable-shared /bin/sh: 1: cd: can\'t cd to /opt/app/openet/oetal1/chenhe/pcre2-10.23 objs/Makefile:1202: recipe for target \'/opt/app/openet/oetal1/chenhe/pcre2-10.23/Makefile\' failed make[1]: *** [/opt/app/openet/oetal1/chenhe/pcre2-10.23/Makefile] Error 2 make[1]: Leaving directory \'/home/liuhan168/docment/toolstonginx/nginx-1.12.0\' Makefile:8: recipe for target \'build\' failed make: *** [build] Error 2 root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# make clean root@liuhan888:/home/liuhan168/docment/toolstonginx# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx# tar -zxvf pcre-8.39.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre-8.39# ./configure root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre-8.39# make root@liuhan888:/home/liuhan168/docment/toolstonginx/pcre-8.39# make install root@liuhan888:/home/liuhan168/docment/toolstonginx# ls -l 总用量 10816 drwxr-xr-x 9 1001 1001 4096 5月 28 12:13 nginx-1.12.0 -rw-r--r-- 1 root root 980831 4月 12 23:11 nginx-1.12.0.tar.gz drwxr-xr-x 21 root root 4096 5月 28 11:42 openssl-1.0.2l -rw-r--r-- 1 root root 5365054 5月 25 21:09 openssl-1.0.2l.tar.gz drwxr-xr-x 8 1169 1169 4096 5月 28 11:20 pcre2-10.23 -rw-r--r-- 1 root root 2020247 5月 28 11:14 pcre2-10.23.tar.gz drwxr-xr-x 9 1169 1169 12288 5月 28 12:00 pcre-8.39 -rw-r--r-- 1 root root 2062258 5月 28 11:58 pcre-8.39.tar.gz drwxr-xr-x 14 501 staff 4096 5月 28 11:21 zlib-1.2.11 -rw-r--r-- 1 root root 607698 1月 16 02:13 zlib-1.2.11.tar.gz root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# ./configure \\ > --sbin-path=/usr/local/nginx/nginx \\ > --conf-path=/usr/local/nginx/nginx.conf \\ > --pid-path=/usr/local/nginx/nginx.pid \\ > --with-http_ssl_module \\ > --with-pcre=/home/liuhan168/docment/toolstonginx/pcre-8.39 \\ > --with-zlib=/home/liuhan168/docment/toolstonginx/zlib-1.2.11 \\ > --with-openssl=/home/liuhan168/docment/toolstonginx/openssl-1.0.2l root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# make root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# make install root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# sudo /usr/local/nginx/nginx nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# netstat -ano|grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN off (0.00/0/0) unix 2 [ ] DGRAM 19380 root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# cd /usr/local/nginx root@liuhan888:/usr/local/nginx# ls client_body_temp fastcgi_params html logs nginx nginx.pid scgi_params.default uwsgi_params.default fastcgi.conf fastcgi_params.default koi-utf mime.types nginx.conf proxy_temp scgi_temp uwsgi_temp fastcgi.conf.default fastcgi_temp koi-win mime.types.default nginx.conf.default scgi_params uwsgi_params win-utf root@liuhan888:/usr/local/nginx# vim nginx.conf server { listen 8088; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# sudo /usr/local/nginx/nginx root@liuhan888:/home/liuhan168/docment/toolstonginx/nginx-1.12.0# ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:be:6e:4b inet addr:192.168.33.133 Bcast:192.168.33.255 Mask:255.255.255.0
以上是关于安装nginx的主要内容,如果未能解决你的问题,请参考以下文章
nginx.conf 忽略了 nginx-ingress 配置映射片段
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途