IP Address
The IP address is a "number" of the computer, and the number is unique. Equivalent to our ID card number.
IP address format: A.B.C.D, the range of values for each segment is 0-255.
IP address of this machine: 127.0.0.1 You can only access yourself by yourself and others cannot access your computer through this IP.
domain name of the machine: localhost You can only visit yourself, others cannot access your computer through this domain.
Anyone who wants to access your computer must access it through the IP address of the network card.
nslookup www.baidu.com Command window to see the IP address of the domain name
domains (domain name)
The exchange of visits between computers on the Internet only recognizes access to IP addresses and cannot directly identify domain names .
IP--------DNS------Domain Name
Because the IP address is not regular, it is difficult to remember, so someone invented a "domain name" thing.
"Domain Name" is to use a few symbols, to represent a host, convenient memory. such as:www.baidu.com Baidu is the domain name
The largest domain name quotient: WAN Network (net.cn), new network, western data, soil and so on.
Domain Name resolution system (DNS)
DNS Domain Name System, domain name management systems, name resolution systems.
The primary purpose of DNS is to convert the domain name to an IP address .
DNS server: The computer on which the DNS software is installed. The DNS server is primarily responsible for the task of resolving domain names.
Apache server: The Apache software PC is installed.
Mailbox server: The computer on which the mailbox server is installed.
FTP server: The computer on which the FTP software is installed.
Local dns--hosts file
File path: C:\Windows\System32\drivers\etc\hosts
The Hosts file is a hidden file with no extension.
Tip: If you want to access some sites faster solution: is directly in the hosts file to include the corresponding IP address and domain name.
how PHP Web pages work
Apache Server Introduction
Apache is currently one of the most popular servers, accounting for 60% of the market share.
Common servers: Apache (PHP, Java), IIS (ASP, ASP)
installation of Phpstudy
Installation path: C:\Program Files (x86) \phpstudy
Web site root directory: E:\www
Note: The installation path cannot appear in Chinese, and the name of the PHP file cannot be Chinese.
Phpstudy directory Structure
PhpMyAdmin Web programs for database management Path: E:\www\phpMyAdmin
phpMyAdmin account: Username and password are root
Apache start and Stop methods
First Method: Task Manager
Path: Computer--Right click--Management--service
Second approach: Start Apache and MySQL in cmd mode
Path: Start Menu--run--Input cmd
net start Apache2 Open service
net stop apache2 Service
Apache configuration file Syntax check
Apache Master profile:C:\Program files (x86) \phpstudy\apache2\conf\httpd.conf
Apache Virtual Host configuration file: C:\Program Files (x86) \phpstudy\apache2\conf \vhosts.conf
Syntax checking for Apache configuration files (httpd.conf)
-t command syntax check
If the following problem occurs, the "environment variable" is not configured for the system.
Path: Computer--Properties--Advanced system settings--advanced--System variable--path
Apache configuration Commands
1. documentroot--website root directory
Note: The E:\www directory must exist, and the path cannot contain Chinese.
2, directoryindex--default home settings
Multiple home files are separated by a "space". If none of the home files exist, a list of directories is displayed.
3. Listen command
When Apache is started, it is the port on which the specified service is listening, and which port on which IP is being accessed.
The port that listens for the IP of its network card.
A host can have multiple network cards (at least two, one wired, one wireless). A network card can set multiple IP addresses.
Understand the port:
Format: Listen IP address [: Port number]
Example: Listen 80//Listen for 80 port requests for all IPs
Listen 192.168.40.52//listening for requests 192.168.40.52 all ports
Listen 192.168.40.52:80//80 port listening on 192.168.40.52IP address
<directory></directory>--Directory Permissions
DocumentRoot "E:\www"
<directory "E:\www" >
Options Indexes|none|all
Order Deny,allow
Deny from all
Allow from 192.168.40.52
</Directory>
Options: Specify what attributes the directory has, value: None, all, indexes
U None: Disables all IP access.
U all: Have all permissions
U Indexes: Displays the directory list if the home page does not exist.
L Order:deny (Disabled) and allow (allowed) order of execution.
u Example: Order deny,allow
L Deny: Which IP access is forbidden.
U Deny from all//disable all IP access
U Deny from 192.168.10.25//disable 192.168.10.25 IP access to my console
L Allow: Which IP access is allowed
U allow from all//Permit all IP access
U let from 127.0.0.1//Only allow me to access it myself
The concept of a virtual host
Divide a disk into small spaces and let it be rented out. Every small space that has all the features of the site.
the configuration of the virtual host is too sudden
First step: Configure the local DNS file (hosts)
File path: C:\Windows\System32\drivers\etc\hosts
Step two: Apache's main configuration file (httpd.conf)
File path: C:\Program files (x86) \phpstudy\apache2\conf\httpd.conf
Namevirtualhost is one of the most important commands for configuring a domain-based virtual host. In other words, it means configuring the virtual host for what IP port. The IP address here is its own NIC, not someone else's.
The configuration file for the virtual host is loaded through the include command.
Step three: Apache Virtual Host configuration file (vhosts.conf)
File path: C:\Program files (x86) \phpstudy\apache2\conf\vhosts.conf
Use <VirtualHost></VirtualHost> in vhosts.conf to define multiple virtual hosts
After configuring the virtual host, why is the localhost access path changed?
The priority of the virtual host configuration is higher than the global configuration in httpd.conf.
When accessing a domain name defined in the hosts, but the domain name does not have a virtual host configuration, then the domain name will point to the 1th virtual host.
When the virtual host is configured, the original localhost access path has been modified because the 1th virtual host has the highest priority.
IP, Apache Virtual Host configuration Section learning notes