4.django restframework deploy the project to the ubuntu18.04 (installation configuration nginx)

1. Install Nginx

apt-get install nginx
y

2.Nginx Configuration

1. Delete the default:

Copy the code
# Prevent errors, first delete the default file to 
cd / etc / nginx / sites-the Available / 
RM default 
LS 
cd / etc / nginx / sites-Enabled 
LS 
RM default 
LS
Copy the code

2. Create a new configuration file:

cd /etc/nginx/sites-available/
vim gg.conf

3. Edit Content:

i # to enter edit mode

content:

Copy the code
server{
  listen 80;
  server_name gg;
  charset utf-8;

  client_max_body_size 75M;

  location /static {
    alias /home/ubuntu/gg/static;
  }
  location /media {
    alias /home/ubuntu/gg/media;
  }

  location / {
    uwsgi_pass 127.0.0.1:8000;
    include /etc/nginx/uwsgi_params;
  }
}
Copy the code

Save and exit:

+ Esc to enter: wq + Enter to save and exit #

 

Guess you like

Origin www.cnblogs.com/xuepangzi/p/11109084.html