博客
关于我
ngnix配置文件
阅读量:797 次
发布时间:2023-02-15

本文共 2274 字,大约阅读时间需要 7 分钟。

Nginx???????

1. ??????

1.1 ????

worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# ??????include /usr/share/doc/nginx/README.dynamic.include;include /usr/share/nginx/modules/*.conf;

1.2 ????

events {    worker_connections 1024;}

1.3 ????

http {    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 /var/log/nginx/access.log main;    sendfile on;    tcp_nopush on;    tcp_nodelay on;    keepalive_timeout 65;    types_hash_max_size 2048;    include /etc/nginx/mime.types;    default_type application/octet-stream;        # ??????    include /etc/nginx/conf.d/*.conf;}

1.4 ??????

server {    listen 80;    server_name www.yblisgglib.online;        # ???????HTTPS    rewrite ^/(.*) https://www.yblisgglib.online/$1 permanent;}server {    listen 443 ssl;    server_name www.yblisgglib.online;        # ??????    access_log /var/log/nginx/example.com_access.log combined;    error_log /var/log/nginx/example.com_error.log error;        # ????    ssl_certificate /etc/nginx/cert/4296312_yblisgglib.online.pem;    ssl_certificate_key /etc/nginx/cert/4296312_yblisgglib.online.key;        # ??????    location /static {        alias /home/login/static;    }        # ????    location / {        include uwsgi_params;        uwsgi_pass 127.0.0.1:8000;        proxy_set_header Host $http_host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }}

2. uwsgi.ini??

[uwsgi]socket=127.0.0.1:8000chdir=/home/loginwsgi-file=/home/login/wsgi.pyhome=/env/venvprocesses=4threads=2master=Truepidfile=uwsgi.piddaemonize=uwsgi.logpython-autoreload=1

3. ????????

3.1 ????

  • ??????????????????403 Forbidden?404 Not Found????????Nginx????????????

3.2 ????

  • ???????

    • ?????????????
      location /static {    alias /home/login/static;}
    • ??/home/login/static???????
  • ?????

    • ????????????Nginx?????????????
  • ?????

    • ?????????Nginx???
      sudo systemctl restart nginx
  • 4. ????

    • ???????

      • ????????????????#????????
    • ?????

      • ???????????
        mkdir -p /var/log/nginxchmod 755 /var/log/nginx
    • ?????

      • ??SSL????????????????????
    • uwsgi???

      • ??uwsgi????????????????127.0.0.1:8000?

    ???????????????????????????????????Nginx????????????

    转载地址:http://pyjfk.baihongyu.com/

    你可能感兴趣的文章
    Nginx配置代理解决本地html进行ajax请求接口跨域问题
    查看>>
    nginx配置全解
    查看>>
    Nginx配置参数中文说明
    查看>>
    Nginx配置后台网关映射路径
    查看>>
    nginx配置域名和ip同时访问、开放多端口
    查看>>
    Nginx配置多个不同端口服务共用80端口
    查看>>
    Nginx配置好ssl,但$_SERVER[‘HTTPS‘]取不到值
    查看>>
    Nginx配置如何一键生成
    查看>>
    Nginx配置实例-动静分离实例:搭建静态资源服务器
    查看>>
    Nginx配置实例-反向代理实例:根据访问的路径跳转到不同端口的服务中
    查看>>
    Nginx配置实例-反向代理实现浏览器请求Nginx跳转到服务器某页面
    查看>>
    Nginx配置实例-负载均衡实例:平均访问多台服务器
    查看>>
    Nginx配置文件nginx.conf中文详解(总结)
    查看>>
    nginx配置文件nginx.conf超详细讲解
    查看>>
    Nginx配置文件详解
    查看>>
    Nginx配置自带的stub状态实现活动监控指标
    查看>>
    Nginx配置详解
    查看>>
    nginx配置详解
    查看>>
    nginx配置详解、端口重定向和504
    查看>>
    nginx配置负载均衡
    查看>>