完整版安装过程请参考Gitlab+Jenkins+Ansible安装过程(完整版)on Centos7
在webservers客户机安装nginx (on ubuntu1804)
future@future:~$ apt update
future@future:~$ sudo apt install nginx
future@future:~$ sudo ufw status
Status: inactive
# 如果防火墙已经关闭,则下列操作可以不用
future@future:~$ sudo ufw app list
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
future@future:~$ sudo ufw allow 'Nginx HTTP'
# 这条命令选用
future@future:~$ netstat -nplt
future@future:~$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: active (running) since Sun 2020-01-19 15:59:56 UTC; 3min 53s ago
Docs: man:nginx(8)
Process: 5747 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code
Process: 5738 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
Main PID: 5748 (nginx)
Tasks: 7 (limit: 4915)
CGroup: /system.slice/nginx.service
├─5748 nginx: master process /usr/sbin/nginx -g daemon on; master_pro
├─5751 nginx: worker process
├─5752 nginx: worker process
├─5754 nginx: worker process
├─5756 nginx: worker process
├─5758 nginx: worker process
└─5759 nginx: worker process
future@future:~$ sudo vim /etc/nginx/sites-enabled/default
# root /var/www/html;
root /usr/share/nginx/html;
future@future:~$ sudo sh -c "echo nginx default index file > /usr/share/nginx/html/index.html"
future@future:/etc/nginx/sites-enabled$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is