linux 服務器部署

1.apt-get update 更新軟件源html

2.確保安裝ssh服務,方便從本地鏈接服務器python

3.sudo apt-get install nginx gunicorn python-gevent supervisor mysql-servermysql

4. sudo apt-get install python-jinja2 python-mysql.connectornginx

5.mysql -u root -p < schema.sqlsql

6.sudo easy_install(pip install) supervisor==3.0b2ubuntu

7.echo_supervisord_conf > /etc/supervisord.conf服務器

配置:app

[program:xxx]ssh

command     = /usr/bin/gunicorn --bind 127.0.0.1:9000 --workers 1 --worker-class gevent wsgiapp:application3d

directory   = /srv/xxx/www

user        = root

startsecs   = 3

 

redirect_stderr         = true

stdout_logfile_maxbytes = 50MB

stdout_logfile_backups  = 10

stdout_logfile          = /srv/xxx/log/app.log

 

command:

sudo supervisord sudo supervisorctl

link:http://tuzii.me/diary/522dc528848eea683d7724f2/%E8%A7%A3%E5%86%B3ubuntu-supervisor-unix:var-run-supervisor.sock-no-such-file.%E7%9A%84%E6%96%B9%E6%B3%95

其餘:

$ sudo supervisorctl reload
$ sudo supervisorctl start awesome
$ sudo supervisorctl status

8.應用打包發佈

9.依賴模塊安裝

10。/etc/nginx/sites-available/目錄下放入配置文件

server {

    listen      80; 

 

    root       /srv/xxx/www;

    access_log /srv/xxx/log/access_log;

    error_log  /srv/xxx/log/error_log;

 

 

    location /favicon.ico {

        root /srv/xxx/www;

    }

 

  

    location ~ ^\/static\/.*$ {

        root /srv/xxx/www;

    }

 

   

    location / {

        proxy_pass       http://127.0.0.1:9000;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header Host $host;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        client_max_body_size    100m;

    }

}

11./etc/nginx/sites-enabled/目錄下建立軟連接:sudo ln -s /etc/nginx/sites-available/awesome .

12.重啓nginx:  sudo /etc/init.d/nginx reload

13.filezile上傳文件:

http://jingyan.baidu.com/article/3d69c5516f4b82f0cf02d7a2.html

相關文章
相關標籤/搜索