• Kernel version number
  • uname -r
  • System Version number
  • sudo lsb_release -a
  • Right to mention
  • sudo -i
  • name: blissyang pwd: qwer123456
  • CMD type bash to switch to Linux
  • 404 Not Found [IP: 91.189.88.162 80]
  • sudo apt-get update

Ubuntu installation yum

  • sudo apt-get install build-essential
  • sudo apt-get install yum

Install Nginx

  • sudo apt-get install nginx
  • ps -ef | grep nginx
  • sudo service nginx start
  • sudo nginx -t
  • sudo curl localhost
  • ifconfig
  • sudo apt install nginx-full
  • View the process: netstat -ntpl or
  • netstat -ltunp
  • Nginx default installation directory: /etc/nginx
  • Nginx installed successfully:
<! DOCTYPE html> <html> <head> <title>Welcome to nginx! </title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx! </h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>Copy the code

Configuration edit Nginx file:

  • Reference: www.runoob.com/w3cnote/ngi…
  • Vim nginx.conf Press I to start editing, Esc, :wq to save and exit
  • Nginx restart Nginx -s reload

Cat nginx.conf View the nginx configuration file

  • Change user www-data to the current account root

  • [x] server configuration

  • server {

    listen 80;

    server_name 47.93.205.239;

    location / { root /root/Vue-Music/dist/; index index.html index.html; } location ~ / API / {proxy_pass http://47.93.205.239:80; }Copy the code

    }

  • Overall configuration reference:

user root; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; server { listen 80; Server_name 47.93.205.239; location / { root /root/Vue-Music/dist/; index index.html index.html; } location /v1/ { proxy_redirect off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://tingapi.ting.baidu.com/; } location /baidu_music_api/ { # root /root/Vue-Music/dist/; # fastcgi_pass tingapi.ting.baidu.com:80; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; proxy_redirect off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; rewrite ^/baidu_music_api/(.*)$ http://tingapi.ting.baidu.com/$1 last; } } server { listen 80; server_name music.baidu.com; location / { proxy_redirect off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://tingapi.ting.baidu.com/; } ## # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # # # auth_http localhost/auth.php; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } #} } #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # # # auth_http localhost/auth.php; # # pop3_capabilities "TOP" "USER"; # # imap_capabilities "IMAP4rev1" "UIDPLUS"; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # #}}Copy the code

Vue projects are packaged and released

The packaged Vue project is placed directly in the custom server location. Note to create a folder with the same name as the local project, bearing in mind the dist directory on the server side, for use in the Nginx configuration agent.

Please refer to:Blog.csdn.net/qq_33036599…

PS Other Nginx configuration

1. Install git

 sudo apt-get install git
Copy the code

2. Install python

sudo apt-get install python
Copy the code

3. Install the curl library

sudo apt-get install curl
Copy the code
  1. Create a bin file and add it to PATH
mkdir ~/bin
PATH=~/bin:$PATH
Copy the code