Project Deployment Cloud Server Process~

Posted by stlewis on Sat, 08 Jun 2019 19:04:24 +0200

From Congo:


First, to install nginx and MySQL on the server, the website file is recommended at / usr/local/www, environment Python 3.6+mysql 5.7. Ali cloud's server can have a configured public image, otherwise install the environment on its own.

Name of this project: loginOrRegister

For Xiao Bai, the first thing we need to do is to set up and configure nginx Below is the configuration of nginx

1.nginx configuration

Install nginx

# gcc install
yum install gcc-c++

# PCRE pcre-devel install
yum install -y pcre pcre-devel

# zlib install
yum install -y zlib zlib-devel

# OpenSSL install
yum install -y openssl openssl-devel

#Enter the specified directory
cd /usr/local

#download nginx Package, if not wget Command, just yum install wget Installation is sufficient
wget -c

# decompression
tar -zxvf nginx-1.10.1.tar.gz

# To configure
cd nginx-1.10.1

# Compile
make install

# Start, Stop nginx
cd /usr/local/nginx/sbin/  # Execution File Here
./nginx   # start-up
./nginx -s stop  # Stop it
./nginx -s reload  # restart

# query nginx process
ps aux|grep nginx

Notice the location of the configuration file, find it first

Modify Profile

worker_processes  1;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
    listen      80;  # Listen on port, note that the browser is using port 80, you can choose 8000 or whatever you like
    server_name;  # Your domain name
    charset     utf-8;

    client_max_body_size 75M;

    location /static {  # django project static file
        alias /usr/local/www/book/bookmanage/booksys/static;

    location / {  # Port for uwsgi deployment of django project
        include     /usr/local/nginx/conf/uwsgi_params;  # Find the uwsgi_param file under your nginx


Then under cd/usr/local/nginx/sbin, execute. /nginx-t to check if the configuration file has errors, execute. /nginx if not, or. /nginx-s reload to restart nginx

2. Project Files

3.uwsgi Configuration

First pip install uwsgi

Install uwsgi

Uwsgi can be executed with parameters from the command line, this time with the configuration file, uwsgi.ini, the file can be placed in the project, and file.

Contents of uwsgi.ini

chdir = /usr/local/www/wuliu  # Project path, root directory
module = wuliu.wsgi:application  # Just change the project name

master = True
processes = 4
harakiri = 60
max=requests = 5000

socket =  # Set the port to run on, do not conflict
uid =1000
gid = 2000

pidfile = /usr/local/www/
vacuum = True

To the project directory, persist uwsgi --ini uwsgi.ini and close the window directly

4. Notes

mysql connection problem with pycharm

Remote may be rejected by doing the following

If you want the root user to connect to the mysql server from any host using password.

Enter mysql command line first, then execute


Note that this password is a remote connection password that you set up separately from your server's mysql password.This allows you to directly manipulate the server's mysql with pycharm

django project dependency problem

Change the django version on the server side by yourself. Problems with makemigrations and migrate s will occur, errors will occur on your own, typically dependent library problems

Topics: Javascript Nginx MySQL yum Django