lamp配置

nginx源码安装到ubuntu:

/usr/local/nginx/conf/nginx.conf

 

  1 user  root;  # 要指定nginx是由哪个用户启动,否则会出现访问静态文件会错, 不要用root用户
  2 worker_processes  1;
  3 
  4 error_log  logs/error.log;
  5 error_log  logs/error.log  notice;
  6 error_log  logs/error.log  info;
  7 
  8 pid        logs/nginx.pid;
  9 
 10 
 11 events {
 12     worker_connections  1024;
 13 }
 14 
 15 
 16 http {
 17     include       mime.types;
 18     default_type  application/octet-stream;
 19 
 20     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
 21                       '$status $body_bytes_sent "$http_referer" '
 22                       '"$http_user_agent" "$http_x_forwarded_for"';
 23 
 24     #access_log  logs/access.log  main;
 25 
 26     sendfile        on;
 27     #tcp_nopush     on;
 28 
 29     #keepalive_timeout  0;
 30     keepalive_timeout  65;
 31 
 32     #gzip  on;
 33 
 34     # the upstream component nginx needs to connect to
 35     upstream django {
 36     # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
 37     server 127.0.0.1:8000; # for a web port socket (we'll use this first)
 38     }
 39     # configuration of the server
 40 
 41     server {
 42     # the port your site will be served on
 43     listen      80;
 44     # the domain name it will serve for
 45     server_name 39.104.68.149; # substitute your machine's IP address or FQDN
 46     charset     utf-8;
 47 
 48     # max upload size
 49     client_max_body_size 100M;   # adjust to taste
 50 
 51     # Django media
 52     location /media/  {
 53         alias /root/Books/media/;  # 指向django的media目录必须以斜杠收尾,否则会找不到文件
 54     }
 55 
 56     }
 57 
 58     location /static/ {
 59         alias /root/Books/static/; # 指向django的static目录, 必须以斜杠收尾
 60     }
 61 
 62     # Finally, send all non-media requests to the Django server.
 63     location / {
 64         uwsgi_pass  django;
 65         include     uwsgi_params; # the uwsgi_params file you installed
 66     }
 67 
 68 
 69     }
 70 
 71 
 72     # another virtual host using mix of IP-, name-, and port-based configuration
 73     #
 74     #server {
 75     #    listen       8000;
 76     #    listen       somename:8080;
 77     #    server_name  somename  alias  another.alias;
 78 
 79     #    location / {
 80     #        root   html;
 81     #        index  index.html index.htm;
 82     #    }
 83     #}
 84 
 85 
 86     # HTTPS server
 87     #
 88     #server {
 89     #    listen       443 ssl;
 90     #    server_name  localhost;
 91 
 92     #    ssl_certificate      cert.pem;
 93     #    ssl_certificate_key  cert.key;
 94 
 95     #    ssl_session_cache    shared:SSL:1m;
 96     #    ssl_session_timeout  5m;
 97 
 98     #    ssl_ciphers  HIGH:!aNULL:!MD5;
 99     #    ssl_prefer_server_ciphers  on;
100 
101     #    location / {
102     #        root   html;
103     #        index  index.html index.htm;
104     #    }
105     #}
106 
107 }

uwsgi:

 1 # mysite_uwsgi.ini file
 2 [uwsgi]
 3 
 4 # Django-related settings
 5 # the base directory (full path)
 6 chdir           = /root/Books
 7 # Django's wsgi file
 8 module          = Books.wsgi
 9 # the virtualenv (full path)
10 
11 # process-related settings
12 # master
13 master          = true
14 # maximum number of worker processes
15 processes       = 10
16 # the socket (use the full path to be safe
17 socket         = 127.0.0.1:8000
18 # ... with appropriate permissions - may be needed
19 # chmod-socket    = 664
20 # clear environment on exit
21 vacuum          = true
22 virtualenv = /root/.virtualenvs/Books
23 
24 logto = /tmp/uwsgi.log

 

posted @ 2018-04-14 15:03  倪兴国  阅读(193)  评论(0编辑  收藏  举报