It took a long time today to configure Apache, referring to some of the blog post combined with their actual configuration situation, summarized as follows:
First, enter "Open/etc" under terminal, open Apache2-httpd.conf, modify Apache configuration file httpd.conf
which
(1) The directory in ServerRoot is the system installation directory, also for the httpd run directory, do not modify
(2) Listen 80 default Listener 80 port, in case no other application occupies 80 port, can not be modified
(3) serveradmin is the administrator mailbox, when a problem occurs, the server will send mail to this mailbox, can not be modified
(4) servername is the hostname, you need to ServerName before the "#" removed, www.example.com modified to host DNS domain name localhost, or IP address 127.0.0.1
www.example.com is just a sample field
ServerName提供用于识别它自己的名字和端口。名字和端口通常由服务器自动定义,
但是建议你明确地指定它以避免启动过程中产生问题。
Note: "#" does not remove, although It does not affect the display of "It works! ", however, AH00557 and AH00558 errors occur when the terminal enters" Apachectl configtest ":
(5) Deny all access to your server file system, if necessary, can be modified, temporarily do not change
(6) Here is the default directory for Web pages, modify the path
(7) The display file of the home page (that is, "It works! "), You can simply move the index.html file under the original path into the new path without making any changes .
Note: If you have modified the web hosting directory, you need to move the index.html under the original path to the new path, or you will see a 403 error
For this reason, I configured the majority of days, thought is the authority problem, around a large circle after the discovery is this problem, careless .....
Two
The command line that is used
Httpd-v View Apache version
sudo apachectl stop off Apache
sudo apachectl start Apache
sudo apachectl restart restart Apache
APACHECTL configtest Check Apache syntax ( useful to help with configuration troubleshooting )
Late permission settings, should be required, temporarily do not write (considering the version of Apache differences)
Mac Configuration apache2.4.25 Server