• 실행순서
    • Weppy install 및 Weppy Application 작성
    • Nginx 설치 및 Nginx Configuration file 설정
    • uWSGI 설치
    • uWSGI + Weppy Application 실행
    • Nginx 재실행



  • Nginx
    • Nginx 설치
      sudo aptitude install software-properties-common
      sudo add-apt-repository ppa:nginx/development
      sudo apt-get update
      sudo apt-get install nginx
    • Nginx Configuration File 설정
      • Configuration File 경로
        /etc/nginx/sites-available/<사용하고싶은파일이름>
      • Configuration File 내용
        # configuration file 내용
        worker_processes  1;

        events {
           worker_connections  30000;
        }

        http {
           include       mime.types;
           default_type  application/octet-stream;

           keepalive_timeout  65;

           upstream pingpong {
               ip_hash;
               #server unix:/var/nginx/uwsgi.sock;
               server unix:/tmp/weppy_app.sock
           }

           server {
               #listen       9090;
               listen          80;
               #server_name  localhost;
               server_name     10.110.25.25;

               location / {
                   uwsgi_pass  pingpong;
                   include     uwsgi_params;
               }

               error_page   500 502 503 504  /50x.html;
               location = /50x.html {
                   root   html;
               }
           }
        }
    • Nginx 재실행 방법 1

      sudo service nginx start
      sudo service nginx stop
      sudo service nginx restart

      sudo /etc/init.d/nginx start
      sudo /etc/init.d/nginx stop
      sudo /etc/init.d/nginx restart
    • Nginx 재실행 방법 2
      • 주로 Nginx 의 config file 의 내용을 change 한 후에 사용
        sudo nginx -s reload
    • Nginx Error 다루기 (Dealing with error messages on screen)
      • Nginx server failed to start, stop or restart, check for the syntax error
        nginx -t
        ## OR set path to config file and test for the errors ##
        nginx -c /etc/nginx/nginx.conf -t
    • Nginx Main Configuration File
      sudo vi /etc/nginx/nginx.conf
      # or
      sudo vi +2 /etc/nginx/nginx.conf        # +2 option : Line number 2 로 가라.
      # or
      sudo nano /etc/nginx/nginx.conf
    • Nginx Log File 분석하기

      sudo tail -f /var/log/nginx/error.log # -f option 은 봐서 사용하자.

    • Nginx paths
      juce@juce-ubuntu:~$ sudo find / -name nginx
      [sudo] password for juce:
      /usr/sbin/nginx
      /usr/share/doc/nginx
      /usr/share/nginx
      /root/.cache/bazel/_bazel_root/07b20b5ccedef4525b748f38dd9e8537/external/prism/tests/languages/nginx
      /var/lib/nginx
      /var/log/nginx
      /etc/init.d/nginx
      /etc/default/nginx
      /etc/logrotate.d/nginx
      /etc/nginx
    • 이상 Nginx 설정 끝


  • uWSGI
    • uWSGI 설치

      sudo apt-get install uwsgi    # 아래의 실행 명령어가 제대로 실행되지 않는 bug 가 있음 sudo -H pip install uwsgi     # so, pip 로 install 추천

    • uWSGI + Weppy Application 
      # --http :80            # port 번호 설정 반드시 해줄 것
      # /tmp/weppy_app.sock   # 앱 실행시 socket 이름
      # database_basic:app    # 자신의 앱 이름
      sudo uwsgi --http :80 -s /tmp/weppy_app.sock -w database_basic:app
    • 이상 uWSGI 설치 및 실행 끝


  • Celery
    • Reference
    • Celery  설치

      sudo -H pip install celery

    • Celery  실행

      celery -A jmcelery.tweet_worker:app worker -l info    # 이 부분은 각자의 상황에 따라서 할 것. 이 것은 나의 경우임.

    • Celery 실행 끝

  • 예비


+ Recent posts