Linux技术区

Linux服务篇之Nginx第二篇

2017-08-22  本文已影响312人  数据革命

简介

准备工作

编译安装

[root@localhost ~]# yum install pcre-devel pcre -y

[root@localhost ~]# rpm -qa pcre pcre-devel
pcre-7.8-7.el6.x86_64
pcre-devel-7.8-7.el6.x86_64
[root@localhost ~]# yum  install openssl openssl-devel -y
[root@localhost ~]# rpm -qa openssl openssl-devel 
openssl-1.0.1e-57.el6.x86_64
openssl-devel-1.0.1e-57.el6.x86_64
useradd  nginx -s /sbin/nologin -M
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  nginx-1.12.1.tar.gz
[root@localhost ~]# tar xfv nginx-1.12.1.tar.gz 
nginx-1.12.1/
nginx-1.12.1/auto/
nginx-1.12.1/conf/
nginx-1.12.1/contrib/
nginx-1.12.1/src/
nginx-1.12.1/configure
nginx-1.12.1/LICENSE
nginx-1.12.1/README
nginx-1.12.1/html/
nginx-1.12.1/man/
nginx-1.12.1/CHANGES.ru
nginx-1.12.1/CHANGES
nginx-1.12.1/man/nginx.8
nginx-1.12.1/html/50x.html
nginx-1.12.1/html/index.html
nginx-1.12.1/src/core/
nginx-1.12.1/src/event/
nginx-1.12.1/src/http/
nginx-1.12.1/src/mail/
nginx-1.12.1/src/misc/
[root@localhost ~]# cd nginx-1.12.1
[root@localhost nginx-1.12.1]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
[root@localhost nginx-1.12.1]#  ./configure  --user=nginx --group=nginx --prefix=/application/nginx --with-http_stub_status_module --with-http_ssl_module
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library

  nginx path prefix: "/application/nginx"
  nginx binary file: "/application/nginx/sbin/nginx"
  nginx modules path: "/application/nginx/modules"
  nginx configuration prefix: "/application/nginx/conf"
  nginx configuration file: "/application/nginx/conf/nginx.conf"
  nginx pid file: "/application/nginx/logs/nginx.pid"
  nginx error log file: "/application/nginx/logs/error.log"
  nginx http access log file: "/application/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
[root@localhost nginx-1.12.1]# make && make install
        || cp conf/uwsgi_params '/application/nginx/conf'
cp conf/uwsgi_params \
        '/application/nginx/conf/uwsgi_params.default'
test -f '/application/nginx/conf/scgi_params' \
        || cp conf/scgi_params '/application/nginx/conf'
cp conf/scgi_params \
        '/application/nginx/conf/scgi_params.default'
test -f '/application/nginx/conf/nginx.conf' \
        || cp conf/nginx.conf '/application/nginx/conf/nginx.conf'
cp conf/nginx.conf '/application/nginx/conf/nginx.conf.default'
test -d '/application/nginx/logs' \
        || mkdir -p '/application/nginx/logs'
test -d '/application/nginx/logs' \
        || mkdir -p '/application/nginx/logs'
test -d '/application/nginx/html' \
        || cp -R html '/application/nginx'
test -d '/application/nginx/logs' \
        || mkdir -p '/application/nginx/logs'
make[1]: Leaving directory `/root/nginx-1.12.1'
[root@localhost nginx-1.12.1]# ln   -s  /application/nginx-1.12.1  /application/nginx
[root@localhost nginx-1.12.1]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] getpwnam("nginx") failed
nginx: configuration file /application/nginx/conf/nginx.conf test failed
[root@localhost ~]# /application/nginx/sbin/nginx 
vim /etc/profile.d/app.sh
export PATH=/app/httpd24/bin:$PATH
[root@localhost ~]# ss -nutl
Netid  State      Recv-Q Send-Q                                                   Local Address:Port                                                     Peer Address:Port 
udp    UNCONN     0      0                                                                    *:68                                                                  *:*     
tcp    LISTEN     0      128                                                                  *:80                                                                  *:*     
tcp    LISTEN     0      128                                                                 :::22                                                                 :::*     
tcp    LISTEN     0      128                                                                  *:22                                                                  *:*     
tcp    LISTEN     0      100                                                                ::1:25                                                                 :::*     
tcp    LISTEN     0      100                                                          127.0.0.1:25                                                                  *:*  
上一篇下一篇

猜你喜欢

热点阅读