php--Basic Use

Source: Internet
Author: User

Apache Installation and Configuration

Install
    • : https://www.apachelounge.com/download/, select 2.4.33 version 64-bit
    • Unzip the program into an English directory to open CMD as an administrative identity
    • cd < Unzip directory >/bin, execute command switch to Apache extracted drive letter Bin directory
    • Httpd.exe-k install-n "Apache", execute the command to the bin directory under the httpd installation, the-n parameter is the name of the specified server, the default name is Apache24, ugly, so changed to Apache
    • Httpd.exe-k uninstall-n "Apache", execute command to uninstall Apache
    • After executing the installation command, there will be an error, probably meaning that the root directory specified in the HTTP.COF configuration file in the Conf directory serveroot is not a valid directory
Errors reported here must is corrected before the service can be started.
Panax Notoginseng c:/apache/conf/httpd.conf:serverroot must be a valid directory
    • We found this configuration file, the root directory specified in line 37 is ServerRoot "C:/apache24", but we unzipped because changed the name, so the configuration file we also need to make the corresponding changes, modified to ServerRoot "C:/apache"
    • Again to execute the cmd command, HTTPD.EXE-T, httpd.exe whether the correct installation to test, found another error, error or in the above configuration file, probably meaning in 248 lines, DocumentRoot ' C:/apache24/htdocs ' is not a directory or unreadable, in fact, and changed the name has a relationship, so select the place where the error occurs, use sublime shortcut keys always press Ctrl+d until the end of the file, to modify
Ah00526:syntax error on line 248 of C:/apache/conf/httpd.conf:documentroot ' C:/apache24/htdocs ' are not a directory, or is Not readable
    • Modified after the execution of the HTTPD.EXE-T Test command, found syntax OK, but there is still a mistake, probably meaning missing server domain name, prompting us to servename this command to global settings. What we need to explain here is that we can actually ignore this error, because we need to do the virtual host later

Set the ' ServerName ' directive globally to suppress this message
    • At this point we open the service by running =>services.msc and see that the Apache service has been successfully installed, but it does not show boot.

Start
    • Httpd.exe-k start-n "Apache" after executing the command, still will report the above AH00558 error, here we ignore, at this time to check the service, Aapche service is already running

    • When we enter 127.0.0.1 in the browser, it will pop up it works
Dns
    • Here we introduce the concept of DNS, the customer sends the request, the first from the local hosts file to find the domain name matching IP, otherwise it will go to the DNS server to resolve, and then obtain the IP before going to the Web server to obtain data. We can still access the hosts file under local C:\Windows\System32\drivers\etc by modifying the
127.0. 0.1    Wuqiuxue.dec

Port
    • The port is like the door that communicates with the outside world, only through this door, the data will pass. When we entered the IP address of 127.1.0.0, we did not enter the port number because the URL would add a 80 port by default. At the same time, 58 lines in the httpd.conf configuration file under Apache's Conf directory were configured with listen 80. So the customer enters the IP address, the natural is to look for this IP address under the 80-port Apache server. We can execute the Netstat-ano command through CMD to see the port occupancy, do see a local service will be 80 ports occupied, here is the PID number of the service--5424, by executing tasklist|findstr "5424" command, We can find out which service is occupying this port, which is obviously Apache.

Site root directory
    • The server will default to the root directory of the Web site is DocumentRoot "C:/apache/htdocs", Htdocs under a index.html file, it is troublesome, we can customize the site root directory. But here again a concept needs to be clarified, the client accesses the data on the server disk through the Apache server 80 port, but does not mean that all the files on all the servers can be accessed, here Apache has the permissions of the settings,/slash represents all the files on the server, Probably means that all overrides are rejected, all requirements are rejected

    • Because it is denied access, so we have to change the site root address, we have to set the changed directory, the system default is require all granted, so we do not have to change

Default Document
    • When a client accesses a directory rather than a specific file, the server returns a document (which can be set) in this directory by default, which is called the default document. The default document can be configured multiple, separated by a space, and looked back until it is available, and if not found, enable a directory browser

Directory browsing
    • It's ugly to enable directory browsing, so let's set it up or configure it in the root of the Web site and delete the index

Virtual Host
    • If multiple sites are deployed on a single machine, we need to address them by configuring the virtual hosts.
    • Httpd.conf in the master configuration file, the introduction of the virtual host is commented out and the comment is dismissed. Then find the directory, find the virtual configuration file to make changes, in order to reduce the main configuration file modification, to achieve a functional single, of course, even if we change the wrong, we can be conf directory under the original directory for recovery operations, where the default configuration of this system

php--Basic Use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.