Centos8.3安装Nginx

1、安装nginx

yum -y install gcc make zlib-devel pcre pcre-devel openssl-devel
sudo yum install -y nginx

2、配置防火墙80与443

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

3、nginx常用命令

查看nginx状态

sudo systemctl status nginx

启用nginx服务器

sudo systemctl start nginx

重新加载nginx服务器

 sudo systemctl reload nginx

禁用nginx服务器

sudo systemctl disable nginx

开机自启

systemctl enable nginx.service 

4、nginx使用位置

配置文件位置

/etc/nginx

日志文件位置

/var/log/nginx

5、修改配置文件 /etc/nginx/nginx.conf

user nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log; #日志地址
pid /run/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include           /etc/nginx/mime.types;
    default_type  application/octet-stream;
    access_log     /var/log/nginx/access.log; #请求日志

    sendfile       on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout  65;

    server {
        listen       80;  #监听端口
        server_name  www.xiaoyaodijun.com;  #监听域名或ip
        charset utf-8;

     

         location /{
                include uwsgi_params;
                uwsgi_pass xxx.xx.xx.xx:7000;  #与uwsgi的通信地址,必须与uwsgi的配置保持一致
                uwsgi_param UWSGI_SCRIPT WebTest.wsgi;#项目wsgi.py目录
                uwsgi_param UWSGI_CHDIR var/dongsheng/WebTest;#项目目录
             }
    }
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值