netstat -nltp | grep 80
# 下载nginx包wget https://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# 建立nginx的yum仓库rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum info nginx
yum --showduplicates list nginx | expand
yum install nginx
yum -y install gcc gcc-c++ autoconf automake make
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel make libtool
yum -y install openssl openssl-devel
groupadd nginxuseradd nginx -g nginx -s /sbin/nologin -M
wget https://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2# 检查平台安装环境./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --user=nginx --group=nginx
make # 编译make install # 安装
user nginx nginx;
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
/usr/local/nginx/sbin/nginx -s stop
ps -ef | grep nginx
curl IP
/usr/local/nginx/sbin/nginx -V
vi /lib/systemd/system/nginx.service
[Unit]Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx reloadExecStop=/usr/local/nginx/sbin/nginx quitPrivateTmp=true [Install] WantedBy=multi-user.target
systemctl enable nginx.service
systemctl status nginx
wget https://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.20.2-1.el7.ngx.x86_64.rpm
rpm -ivh nginx-1.20.2-1.el7.ngx.x86_64.rpm
groupadd nginxuseradd nginx -g nginx -s /sbin/nologin -M
chown -R nginx:nginx /etc/log/logrotate.d/nginxchown -R nginx:nginx /etc/nginxchown -R nginx:nginx /etc/nginx/conf.dchown -R nginx:nginx /etc/config.d/default.confchown -R nginx:nginx /etc/nginx/fastcgi_paramschown -R nginx:nginx /etc/nginx/mime.typeschown -R nginx:nginx /etc/nginx/moduleschown -R nginx:nginx /etc/nginx/nginx.confchown -R nginx:nginx /etc/nginx/scgi_paramschown -R nginx:nginx /etc/nginx/uwsgi_paramschown -R nginx:nginx /usr/lib/systemd/system/nginx-debug.servicechown -R nginx:nginx /usr/lib/systemd/system/nginx.servicechown -R nginx:nginx /usr/lib64/nginxchown -R nginx:nginx /usr/lib64/nginx/moduleschown -R nginx:nginx /usr/libexec/initscripts/legacy-actions/nginxchown -R nginx:nginx /usr/libexec/initscripts/legacy-actions/nginx/check-reloadchown -R nginx:nginx /usr/libexec/initscripts/legacy-actions/nginx/upgradechown -R nginx:nginx /usr/sbin/nginxchown -R nginx:nginx /usr/sbin/nginx-debugchown -R nginx:nginx /usr/share/doc/nginx-1.20.1chown -R nginx:nginx /usr/share/doc/nginx-1.20.1/COPYRIGHTchown -R nginx:nginx /usr/share/man/man8/nginx.8.gzchown -R nginx:nginx /usr/share/nginxchown -R nginx:nginx /usr/share/nginx/htmlchown -R nginx:nginx /usr/share/nginx/html/50x.htmlchown -R nginx:nginx /usr/share/nginx/html/index.htmlchown -R nginx:nginx /var/cache/nginxchown -R nginx:nginx /var/log/nginx
systemctl start nginix
curl IP
# 查看nginx安装文件rpm -qa | grep nginxnginx-1.20.2-1.el7.ngx.x86_64# 卸载nginx安装文件 rpm -e nginx-1.20.2-1.el7.ngx.x86_64
# 获取nginx镜像docker pull nginx:1.21.6# 查看镜像docker images运行nginxdocker run --name nginx -p 80:80 -d nginx
curl IP
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl reload nginx
systemctl enable nginx
systemctl disable nginx
nginx -V
热文推荐