Host hardware configuration

  • Processor: Intel(R) Core(TM) I5-7400 CPU @ 3.00ghz 3.00ghz 4-core
  • RAM: 12.0 GB
  • System type: WINDOWS10 64-bit operating system, based on x64 processor

Configure the VM system

  • Vm: Hyper-V
  • Processor: Intel(R) Core(TM) I5-7400 CPU @ 3.00ghz 3.00ghz 4-core
  • Set RAM to 4.0 GB
  • System type: CentOS7.9 64-bit, thin processor installation based on x64
  • Image: download address

Common commands

Query whether a command exists in the source

yum search xxx

Install the network tool ifconfig

yum install net-tools.x86_64

Install the text editor Vim

This has code highlighting yum install vim

Install the SSH

Vm connection cannot be copied and pasted. Therefore, use three-party SSH login

The installation

# yum install openssh.x86_64 # yum install openssh-server.x86_64Copy the code

Opening a Configuration file

vim /etc/ssh/sshd_config

Setting the configuration file

Save the exit

:wq

Open the service

/bin/systemctl start sshd.service

Verify that the service is enabled

Display process state: ps – e | grep SSHD

According to network status: netstat – an | grep 22

Setting a Firewall

Common commands

Firewall-cmd --reload # open the firewall permanently, --permanent Firewall-cmd --permanent --zone=public --add-port=80/ TCP # Check the firewall, you can see firewall-cmd --list-allCopy the code

Systemctl Command management

Systemctl start firewalld # disable systemctl stop firewalld # disable systemctl status firewalld # If running is displayed, it is runningCopy the code

Install nginx

Import mirror

Since the system image source does not have nginx, you need to import the nginx image source first

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

The VM cannot be copied and pasted. Therefore, we use a third-party SSH tool to log in to the VM for pasting and importing

The installation

yum install nginx

Common commands

Nginx -s reload # signal the main process to reload the configuration file, Nginx -s reopen # restart nginx nginx -s stop # restart nginx -s quit # reopen nginx -t -c < config path > # check whether there is a problem with the configuration. If the configuration directory is already configured, no need for -cCopy the code

Systemctl Command management

The systemctl command is used to manage Nginx. The systemctl command is used to manage Nginx.

Systemctl start nginx # start nginx systemctl stop nginx # stop nginx systemctl restart nginx # restart nginx systemctl reload Nginx # reload nginx Systemctl enable nginx # enable nginx systemctl disable nginx # disable nginx systemctl status nginx # Check nginx Running stateCopy the code

Disabling a security policy

Error 502 is reported on nginx forwarding interface due to Linux security policy

vim /etc/selinux/config

Modify the

Forwarding Interface Settings

My current project is a single-page application packaged with Vue, with only one index. HTML, so except for the home page, everything else goes through forwarding proxy

server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; }... The location ~ / \ S + {proxy_pass http://192.168.235.93:20000; }... }Copy the code