Preface to the zero.
Free today, mainly do before ali cloud server deployed on personal front end after the record of the project, nor used before nginx, before the project is put lot of above, the items that are going to put this period of time on ali cloud, main show is convenient, in order to resume may be looking for work, will be a little bit more convenient, please donate said, So let’s start.
First buy an Ali cloud server, Ali cloud installation nGINx server
1. The Ali cloud server I just bought is equivalent to an empty shell. If I want to put web projects on it, I must use the Web server, and I use nginx server.
2.Nginx is a lightweight Web/reverse proxy server and email (IMAP/POP3) proxy server.
3. There are many specific installation steps on the Internet. After the installation, enter your own Ali Cloud IP address in the browser and press Enter.
Configure nginx
1. If you need the root permission to modify the configuration file, run su and enter the password to obtain the root permission.
su
2. Open your nginx. Conf file, the file location is/usr/local/nginx/conf, the conf file nginx. Conf file, use vim nginx. Conf open the file.
cd /usr/local/nginx/conf
vim nginx.conf
The following is a simple configuration of nginx, fully enough for beginners to use, as follows:
The location in the server needs to be changed, that is
location / {
root /home/liulei;
index index.html index.htm;
}
Copy the code
In the liulei user’s home directory, there are several projects as shown in the figure (total of four projects). Nginx configuration can preview all projects.
events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root /home/liulei index index.html index.htm; } location /nginx_status { stub_status on; access_log off; }}}Copy the code
3. Complete the configuration and exit
1. Start the nginx server
cd /usr/local/nginx/sbin
/nginx Starts the nginx server
4. In the address box of the browser, enter IP + project file name
For example, I want to see a preview of my test project (a front-end navigation project). My IP: 192.192.192.192/test/ SRC will get the final result: