centos7.6安装Nginx-1.15.8安装过程记录

Last login: Mon Mar 11 22:53:00 2019 from 10.0.0.3
[root@vmhzpnginx ~]# whereis nginx
nginx: /usr/local/nginx
[root@vmhzpnginx ~]# cd /usr/local/nginx
[root@vmhzpnginx nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@vmhzpnginx nginx]# cd sbin
[root@vmhzpnginx sbin]# ls
nginx

[root@vmhzpnginx sbin]# ./nginx -s
nginx: option "-s" requires parameter
[root@vmhzpnginx sbin]# ./nginx -s stop
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

[root@vmhzpnginx sbin]# ./nginx
[root@vmhzpnginx sbin]# ps -ef |grep nginx
root 23386 1 0 07:53 ? 00:00:00 nginx: master process ./nginx
www 23387 23386 0 07:53 ? 00:00:00 nginx: worker process
root 23389 23357 0 07:53 pts/0 00:00:00 grep --color=auto nginx
[root@vmhzpnginx sbin]# netstat -an | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 96 172.16.1.222:22 172.16.5.80:61508 ESTABLISHED
tcp 0 0 172.16.1.222:80 172.16.5.80:61568 ESTABLISHED
tcp 0 0 172.16.1.222:80 172.16.5.80:61569 ESTABLISHED
unix 3 [ ] STREAM CONNECTED 31180
unix 2 [ ] DGRAM 80200
unix 3 [ ] STREAM CONNECTED 80386
unix 3 [ ] STREAM CONNECTED 80387
unix 3 [ ] STREAM CONNECTED 28068
unix 3 [ ] STREAM CONNECTED 28069 /run/dbus/system_bus_socket
unix 2 [ ] DGRAM 28051
[root@vmhzpnginx sbin]# ps aux|grep nginx
root 23386 0.0 0.0 46036 1124 ? Ss 07:53 0:00 nginx: master process ./nginx
www 23387 0.0 0.1 46492 2140 ? S 07:53 0:00 nginx: worker process
root 23393 0.0 0.0 112708 976 pts/0 R+ 07:54 0:00 grep --color=auto nginx
[root@vmhzpnginx sbin]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
[root@vmhzpnginx sbin]# pwd
/usr/local/nginx/sbin
[root@vmhzpnginx sbin]# vim /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
"/etc/rc.local" 14L, 495C written

[root@vmhzpnginx sbin]# ls -a /etc/rc.local
/etc/rc.local
[root@vmhzpnginx sbin]# ls -l /etc/rc.local
lrwxrwxrwx. 1 root root 13 Feb 22 01:36 /etc/rc.local -> rc.d/rc.local
[root@vmhzpnginx sbin]# ls -ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 Feb 22 01:36 /etc/rc.local -> rc.d/rc.local
[root@vmhzpnginx sbin]# ls -al /etc/rc.local
lrwxrwxrwx. 1 root root 13 Feb 22 01:36 /etc/rc.local -> rc.d/rc.local
[root@vmhzpnginx sbin]# ls
nginx
[root@vmhzpnginx sbin]# ./nginx -s stop
[root@vmhzpnginx sbin]# reboot
Last login: Tue Mar 12 07:51:30 2019 from 172.16.5.80
[root@vmhzpnginx ~]# ps -ef |grep nginx
root 5521 5501 0 08:00 pts/0 00:00:00 grep --color=auto nginx
[root@vmhzpnginx ~]# ps -ef |grep 80
root 1480 2 0 07:58 ? 00:00:00 [scsi_tmf_2]
root 5523 5501 0 08:00 pts/0 00:00:00 grep --color=auto 80
[root@vmhzpnginx ~]# whereis nginx
nginx: /usr/local/nginx
[root@vmhzpnginx ~]# cd /usr/local/nginx
[root@vmhzpnginx nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@vmhzpnginx nginx]# cd sbin
[root@vmhzpnginx sbin]# ls
nginx
[root@vmhzpnginx sbin]# ./nginx
[root@vmhzpnginx sbin]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
/usr/local/nginx/sbin

[root@vmhzpnginx sbin]# pwd
/usr/local/nginx/sbin
[root@vmhzpnginx sbin]# cd /etc/rc.d
[root@vmhzpnginx rc.d]# ls
init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.local
[root@vmhzpnginx rc.d]# ls -al
total 16
drwxr-xr-x. 10 root root 118 Mar 12 07:55 .
drwxr-xr-x. 81 root root 8192 Mar 12 07:58 ..
drwxr-xr-x. 2 root root 87 Feb 7 08:16 init.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc0.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc1.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc2.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc3.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc4.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc5.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc6.d
-rw-r--r--. 1 root root 495 Mar 12 07:55 rc.local

[root@vmhzpnginx rc.d]# chmod 755 rc.local
[root@vmhzpnginx rc.d]# ls -al
total 16
drwxr-xr-x. 10 root root 118 Mar 12 07:55 .
drwxr-xr-x. 81 root root 8192 Mar 12 07:58 ..
drwxr-xr-x. 2 root root 87 Feb 7 08:16 init.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc0.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc1.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc2.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc3.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc4.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc5.d
drwxr-xr-x. 2 root root 43 Feb 5 15:12 rc6.d
-rwxr-xr-x. 1 root root 495 Mar 12 07:55 rc.local
[root@vmhzpnginx rc.d]# cd /usr/local/nginx/sbin
[root@vmhzpnginx sbin]# ls
nginx
[root@vmhzpnginx sbin]# ./nginx -s stop
[root@vmhzpnginx sbin]# reboot
Last login: Tue Mar 12 07:59:34 2019 from 172.16.5.80

[root@vmhzpnginx log]# whereis nginx
nginx: /usr/local/nginx
[root@vmhzpnginx log]# cd /usr/local/nginx
[root@vmhzpnginx nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@vmhzpnginx nginx]# cd conf
[root@vmhzpnginx conf]# ls
fastcgi.conf koi-utf nginx.conf uwsgi_params
fastcgi.conf.default koi-win nginx.conf.default uwsgi_params.default
fastcgi_params mime.types scgi_params win-utf
fastcgi_params.default mime.types.default scgi_params.default
[root@vmhzpnginx conf]# cat nginx.conf

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}
[root@vmhzpnginx conf]# cd /
[root@vmhzpnginx /]# ls
bin dev home lib64 mnt proc run srv tmp var
boot etc lib media opt root sbin sys usr

[root@vmhzpnginx log]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
/usr/local/nginx/sbin


[root@vmhzpnginx logs]# cd ..
[root@vmhzpnginx nginx]# cd sbin
[root@vmhzpnginx sbin]# ls
nginx
[root@vmhzpnginx sbin]# ./nginx -s reopen
[root@vmhzpnginx sbin]# ls
nginx
[root@vmhzpnginx sbin]# cd ..
[root@vmhzpnginx nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@vmhzpnginx nginx]# cd logs
[root@vmhzpnginx logs]# ls
access.log error.log nginx.pid
[root@vmhzpnginx logs]# cd /home
[root@vmhzpnginx home]# ls
nginx-1.15.8 nginx-1.15.8.tar.gz pcre-8.38 pcre-8.38.tar.gz www
[root@vmhzpnginx home]# cd nginx-1.15.8
[root@vmhzpnginx nginx-1.15.8]# pwd
/home/nginx-1.15.8

猜你喜欢

转载自www.cnblogs.com/tiantom/p/10514384.html