[MacPorts] Apache2.4.x modified

MacPorts noreply at macports.org
Sun Oct 22 16:39:22 UTC 2017


Page "Apache2.4.x" was changed by whmagill
Diff URL: <https://trac.macports.org/wiki/Apache2.4.x?action=diff&version=2>
Revision 2
Comment: second batch of changes - more to come
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: Apache2.4.x
=========================================================================
--- Apache2.4.x (version: 1)
+++ Apache2.4.x (version: 2)
@@ -61,7 +61,7 @@
 === OS X 10.13.x  High Sierra  ===
 Beginning with Yosemite (OSX 10.10), OSX no longer has Personal Web Sharing as an option in System Preferences.
 
-However,  the Apache 2 web server (and PHP 7) is supplied by Apple as part of the High Sierra  distribution (Apache/2.4.27).
+However,  the Apache 2 web server (Apache/2.4.27) and PHP 7, ar supplied by Apple as part of the High Sierra  distribution.
 It is found at `/etc/apache2`; there is no "GUI" way to turn it on (or off), only via the command line.
 It is not turned on, or configured, in a default High Sierra installation.
 
@@ -71,7 +71,7 @@
 === OS X Server ===
 Launch Server Manager and turn off the web server.
 
-= Step 2: Install Apache = #apache
+= Step 2: '''Install Apache''' = #apache
 
 {{{
 $ sudo port install apache2
@@ -83,27 +83,32 @@
 You can edit this file as desired. 
 When you later upgrade apache2 to a newer version, MacPorts will upgrade the sample configuration file but will not modify your `httpd.conf`, so be sure to manually compare your `httpd.conf` with the new sample configuration file and bring over any relevant changes. You should also keep backup copies of your `httpd.conf` in a safe place.
 
-A copy of the origina `httpd.conf` file and the and configuration files in the extra directory, are found in `/opt/local/etc/apache2/original` so you can refer to the defaults later.
-
-=  Step 3:  Verify your config file =
+A copy of the original `httpd.conf` file and the and configuration files in the extra directory, are found in `/opt/local/etc/apache2/original` so you can refer to the defaults later.
+
+=  Step 3:  '''Verify your config file''' =
 Verify any changes you have made to the config file: /opt/local/etc/apache2/httpd.conf
 {{{
 $ /opt/local/sbin/apachectl -t
 }}}
-This will return either "Syntax OK" or a specific line by line error listing.
-
-=  Step 4: Activate Apache2 =
+This will return either "Syntax OK" or a specific line by line error listing. Note that this check is strictly a syntax check. 
+Logic is not verified. 
+
+* Refer to the manual on the Apache website '''https://httpd.apache.org/docs/2.4/''' , or the manual installed at  '''/opt/local/www/apache2/manual/'''. 
+* Note however that the local manual is in html format, and since the server is not working, you will have a difficult time reading it.
+
+=  Step 4: '''Activate Apache2''' =
 Activate your Apache installation so that it starts now and every time you boot your machine: 
 
 {{{
 $ sudo port load apache2
 }}}
-= below not updated yet 
+
 If when you issue this command, you immediately receive the message:
- /opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist: Operation already in progress
-This means that the Launch Daemon believes that it successfully started Apache. At this point, a configuration error is your most likely problem. Verify your config file as above.
-
-After correcting any config errors and saving the updated config file, simply run:
+
+ '''/opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist: service already loaded'''
+
+This means that the Launch Daemon believes that it has successfully started Apache.  You probably did not shut it down in step 1 above:
+
 {{{
 $ sudo port unload apache2
 }}}
@@ -116,23 +121,38 @@
 
 to start it again.
 
-The default log file location is: `opt/local/var/log/apache2/'` The startup will be logged in "'''error_log'''"
-
-= Step 5: Initial changes to the config file =
+* type localhost in the address bar, and press enter. You should see '''It Works! ''' displayed in the browser window.
+
+If the web server  is NOT running at this point, a configuration error is your most likely problem. 
+
+Verify your config file as above.
+
+After correcting any config errors and saving the updated config file, again run:
+{{{
+$ sudo port unload apache2
+$ sudo port load apache2
+}}}
+
+The default log file location is: `opt/local/var/log/apache2/'` The shutdown and startup attempt will be logged in "'''error_log'''"
+
+= Step 5: '''Initial changes to the config file''' =
 Once you have determined that your basic installation is working, you need to consider making some initial changes to your config file.
 
 After each change to the config file, you should again verify the file syntax, and then you need to stop and restart Apache for the changes to take effect.
 
 {{{
-$ /opt/local/apache2/bin/apachectl -t
+$ /opt/local/sbin/apachectl -t
 $ sudo port unload apache2
 $ sudo port load apache2
 }}}
 In Apache documentation (including this page), you will see the use of "''apachectl -k restart''" described as the method to cause the config file to be re-read.
 
-However under OSX, the purpose of ''launchd'' is to notice processes that stop without its knowledge, and to restart them. So if you use ''apachectl -k restart'', launchd may notice apache "crashing" and restart it itself, confusing apachectl. Instead, you shoulduse "port" to tell launchctl to unload apache2, then load it again. This will result in a short interruption of service.
-
-If the sever name is not set properly in the configuration file, `/opt/local/apache2/conf/httpd.conf`, you will encounter the warning below. 
+However under OSX, the purpose of ''launchd'' is to notice processes that stop without its knowledge, and to restart them. 
+So if you use ''apachectl -k restart'', launchd may notice apache "crashing" and restart it itself, confusing apachectl. 
+Instead, you shoulduse "port" to tell launchctl to unload apache2, then load it again. 
+This will result in a short interruption of service.
+
+If the sever name is not set properly in the configuration file, `/opt/local/etc/apache2/httpd.conf`, you will encounter the warning below. 
 
 {{{
 httpd: Could not reliably determine the server's fully qualified domain name, using <Computer-Name>.local for ServerName
@@ -144,17 +164,13 @@
 ServerName localhost:80
 }}}
 
-To verify Apache is now running, point your browser to http://localhost/ (you may need to reload the page). You should see a page that says "It works!"
-
-If desired, reboot your machine and point your browser again to http://localhost/ to confirm that Apache is again running.
-
-'''NOTE:''' The setting of "ServerName" to anything other than the '''Fully Qualified Domain Name''' (FQDN) of the server under Apache 2.2.x and Yosemite, does not produce the expected results.
-Using the links above to "localhost" will fail with Safari complaining "''Failed to open page. Safari can't open the page "localhost" because Safari can't connect to the server "localhost".'' 
-The simple answer is "localhost" is an "old-tyme" shortcut which should still work, but often does not for many different reasons. The "Fix" is to simply use the FQDN of your server when testing Apache or related Web services.
+To verify Apache is now running, point your browser to http://localhost/ (you may need to reload the page). You should see a page that says '''It works! '''
+
+If desired, reboot your machine and point your browser again to http://localhost/ to confirm that Apache is again running following the system boot.
 
 === User directories === #userdir
 
-If you would like to be able to access web pages in the Sites directory of your home directory, edit `/opt/local/apache2/conf/httpd.conf` and locate the following line:
+If you would like to be able to access web pages in the Sites directory of your home directory, edit `/opt/local/etc/apache2/httpd.conf` and locate the following line:
 
 {{{
 #Include conf/extra/httpd-userdir.conf
@@ -165,12 +181,12 @@
 {{{
 Include conf/extra/httpd-userdir.conf
 }}}
-This file:   ''"/opt/local/apache2/conf/extra/httpd-userdir.conf"'' will activate the "Sites" sub-directory for all ~users on your system. (''"/Users/*/Sites"'') and contains initial, basic restrictions for access to the contents of that directory.
-
-After each change to the config file, you should again verify the file syntax, and then you need to stop and restart Apache for the changes to take effect.
-
-{{{
-$ /opt/local/apache2/bin/apachectl -t
+This file:   ''"/opt/local/etc/apache2/extra/httpd-userdir.conf"'' will activate the "Sites" sub-directory for all ~users on your system. (''"/Users/*/Sites"'') and contains initial, basic restrictions for access to the contents of that directory.
+
+After each change to the config file, you should again verify the file syntax, and then you need to stop and restart Apache for the changes to take effect.
+
+{{{
+$ /opt/local/sbin/apachectl -t
 $ sudo port unload apache2
 $ sudo port load apache2
 }}}
@@ -179,7 +195,8 @@
 
 === Local Apache manual === #manual
 
-The [http://httpd.apache.org/docs/2.2/ Apache manual] is available on the Apache web site. If you would like to be able to access a copy of this manual on your web server, edit `/opt/local/apache2/conf/httpd.conf` and uncomment the following line:
+The [http://httpd.apache.org/docs/2.4/ Apache manual] is available on the Apache web site. \\
+If you would like to be able to access a copy of this manual on your web server, edit `/opt/local/etc/apache2/httpd.conf` and uncomment the following line:
 
 {{{
 #Include conf/extra/httpd-manual.conf
@@ -191,24 +208,36 @@
 Include conf/extra/httpd-manual.conf
 }}}
 
-After each change to the config file, you should again verify the file syntax, and then you need to stop and restart Apache for the changes to take effect.
-
-{{{
-$ /opt/local/apache2/bin/apachectl -t
+Then copy the file '''/opt/local/etc/apache2/extras/httpd-manual.conf.orig''' to ''/opt/local/etc/apache2/extras/httpd-manual.conf'' 
+{{{
+ $ cd /opt/local/etc/apache2/extras/
+ $ sudo cp httpd-manual.conf.orig httpd-manual.conf
+ $ sudo chmod og+r httpd-manual.conf
+}}}
+
+At this point: 
+ $ /opt/local/sbin/apachectl -t
+will return the error:
+
+ AH00526: Syntax error on line 36 of /opt/local/etc/apache2/extra/httpd-manual.conf:\\
+ Invalid command 'LanguagePriority', perhaps misspelled or defined by a module not included in the server configuration\\
+
+This means that "LanguagePriority" is not included in the default config.  Edit `/opt/local/etc/apache2/httpd.conf` and uncomment the following line:
+
+ '''LoadModule negotiation_module lib/apache2/modules/mod_negotiation.so'''
+
+After each change to the config file, you should again verify the file syntax, and then you need to stop and restart Apache for the changes to take effect.
+
+{{{
+$ /opt/local/sbin/apachectl -t
 $ sudo port unload apache2
 $ sudo port load apache2
 }}}
 
 You can then view the manual by accessing http://localhost/manual/.
 
-NOTE: This option expects ''"/opt/local/apache2/manual"'' to be accessible under "<Document Root>." This can be accomplished by
-{{{
-$ cd <Document Root>
-$ ln -s /opt/local/apache2/manual
-}}}
-and then accessing: ''http://<servername>/manual/''
-
-=== Apache SSL/TLS Encryption (aks Secure Sockets  or https) === #ssl
+= Not yet updated below here
+= ''' Apache SSL/TLS Encryption (aks Secure Sockets  or https)'''  = #ssl
 '''Note:''' Establishing Secure Sockets is a fairly extensive process. One should first read the current Apache2 documentation found in the Apache2 manual:
 {{{
 http://httpd.apache.org/docs/2.2/ssl/
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/Apache2.4.x>
MacPorts <https://www.macports.org/>
Ports system for macOS

This is an automated message. Someone added your email address to be
notified of changes on 'Apache2.4.x' page.
If it was not you, please report to admin at macports.org.


More information about the macports-changes mailing list