CentOS7.2 and Nginx configuration virtual host

Text content

The article about installing nginx on centos was posted earlier. . . I won’t go into details here anymore, I don’t know how to find information

Use commands to view services

netstat -anpt | grep nginx

Then edit the nginx configuration file, you need to modify the parameters.

vim /usr/local/nginx/conf/nginx.conf

Refer to this picture for modification parameters, which can be customized.

# Add a new module

 server {
  listen    80;
  server_name www.juzhen.com;
  charset utf-8;
  location /{
   root /var/www/juzhen;
   index index.html index.htm;}}
# The following is to modify the original configuration file

 server {
  listen       8080;
  server_name  www.zizhen.com;
  charset utf-8;

  # charset koi8-r;

  # access_log  logs/host.access.log  main;

  location /{
   root   /var/www/zizhen;
   index  index.html index.htm;}

Then modify it in the local analysis directory.

vim /etc/hosts

Change the IP address to your own, don’t write yours!

Create the corresponding website file

# This is the website file of juzhen

mkdir -p /var/www/juzhen

cd /var/www/juzhen

vim index.html

# This is zizhen's website file

mkdir -p /var/www/zizhen

cd /var/www/zizhen

vim index.html

carry out testing

Based on the IP method, you can search for information by yourself, so I won't talk about it here.

Recommended Posts

CentOS7.2 and Nginx configuration virtual host
Centos7 configuration host name and IP address
Build Nginx based on Centos 7 (including virtual host)
Centos mysql installation and configuration
Centos7 installation and configuration prometheus
CentOS 7 installation and configuration PPTP
CentOS installation and configuration cmake
Centos7.5 installation and configuration MongoDB4.0.4
CentOS 7 installation and configuration PPTP
The virtual machine centos and the host ping each other
Centos7 installation and configuration of Jenkins
CentOS 8 install Git and basic configuration
Centos7 hadoop cluster installation and configuration
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
Centos 7 RAID 5 detailed explanation and configuration
CentOS NTP server installation and configuration
Nginx installation and configuration load (ubuntu12.04)
Centos7 mysql database installation and configuration
CentOS 7 system installation and configuration graphic tutorial
Tomcat installation and configuration under CentOS 7 (Tomcat startup)
Installation and configuration of redis under centos7
Ubuntu install PHP and PHP Nginx configuration method
Deploy Docker and configure Nginx in CentOS
Centos7 hive stand-alone mode installation and configuration
CentOS7.0 network configuration
CentOS 7.0 network configuration
CentOS7 basic configuration
Centos7 install Nginx
Centos MySQL8 configuration
CentOS 6.5 system installation and configuration graphic tutorial (detailed graphic)
Virtual machine installation and configuration ubuntu shared folder_
Download of VM virtual machine and install centos7
CentOS7 and Docker configuration Chinese character set problem
CentOS 7 installation and configuration graphic tutorials under VMware10
Centos7 installation of PHP and Nginx tutorial detailed
Centos7.6 dual network card configuration and switching test
Install svn and configuration through yum under CentOS
Installation and configuration of rsync server under CentOS 6.5
Installation and configuration of CentOS 7 in VMware Workstation
CentOS7 Docker Nginx deployment and operation detailed explanation
CentOS 7 install KVM and create a virtual machine
Installing CentOS 6 and SSH configuration under Windows 8 Hyper-V
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
Install centos7 and connect
CentOS MONO nginx running
Vmware-install and start Centos 8
Xfs configuration on centos7
Vmware-install and start Centos 7
OpenMPI-Ubuntu installation and configuration
Centos kernel compilation configuration
Mysql8.0.15 installation configuration (centos7)
Detailed steps to configure Ubuntu 16.04 and Apache virtual host
Environment configuration of JDK, mysql and tomcat under Centos7
Linux firewall related configuration commands and operations (centos and ubuntu)
Python3 configuration and entry.md
How to set up an Apache virtual host on CentOS 7
Detailed explanation of Spark installation and configuration tutorial under centOS7
CentOS7 installation and maintenance of nginx from entry to master
centos7 install python3 and ipython
Know Linux and install CentOS