美文网首页
Django中App绑定不同域名

Django中App绑定不同域名

作者: 冷煖自知 | 来源:发表于2018-05-05 14:12 被阅读118次

    uwsgi+nginx环境中在nginx.conf配置

     # nginx.conf
        user              nginx;
        worker_processes  1;
    
        error_log  /var/log/nginx/error.log;
    
        pid        /var/run/nginx.pid;
    
        events {
            worker_connections  1024;
        }
    
        http {
            include       /etc/nginx/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  /var/log/nginx/access.log  main;
    
            sendfile        on;
            keepalive_timeout  65;
            server {
                listen       80;
                server_name  pc.news.com;
    
                #charset koi8-r;
    
                #access_log  logs/host.access.log  main;
    
                location ~ ^/pc/ {
                    include     uwsgi_params;
                    uwsgi_pass  unix:/var/run/django.socket;
                    uwsgi_param UWSGI_SCRIPT    testsite.wsgi;
                    uwsgi_param UWSGI_CHDIR     /opt/testsite/;
                    index       index.html index.html;
                    client_max_body_size        35M;
                }
            }
            server {
                listen       80;
                server_name  mobile.news.com;
    
                location ~ ^/mobile/ {
                    include     uwsgi_params;
                    uwsgi_pass  unix:/var/run/django.socket;
                    uwsgi_param UWSGI_SCRIPT    testsite.wsgi;
                    uwsgi_param UWSGI_CHDIR     /opt/testsite/;
                    index       index.html index.html;
                    client_max_body_size        35M;
                }
            }
        }
    

    相关文章

      网友评论

          本文标题:Django中App绑定不同域名

          本文链接:https://www.haomeiwen.com/subject/okasrftx.html