0

I am running the default (what I think is Apple's version, not Homebrew / Fink / MacPorts) Apache under OSX Sierra. In configuring the computer for potential use as a server where it may or may not have any domain name assigned, I am trying to set up sites on different high-numbered ports.

Right now I have the following included in /etc/apache2/httpd.conf:

Listen 80
Listen 7000

<VirtualHost *:80>
    ServerAdmin CJSH@CJSHayward.com
    ServerName swissarmyknife.localdomain
    ServerAlias multipurpose.localdomain server.localdomain server localhost
    DocumentRoot "/Users/christos/link"
    <IfModule dir_module>
        DirectoryIndex index.cgi index.php index.shtml index.html
    </IfModule>
    <FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
        Require all denied
    </FilesMatch>
    <Files "rsrc">
        Require all denied
    </Files>
    <DirectoryMatch ".*\.\.namedfork">
        Require all denied
    </DirectoryMatch>
    ErrorLog "/private/var/log/apache2/multipurpose_error_log"
    LogLevel warn
    <IfModule log_config_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common
        <IfModule logio_module>
          LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>
        CustomLog "/private/var/log/apache2/access_log" combined
    </IfModule>
</VirtualHost>


<VirtualHost *:7000>
    ServerAdmin CJSH@CJSHayward.com
    ServerName biblesearch.localdomain
    ServerAlias biblesearch.localdomain biblesearch.localdomain biblesearch
    DocumentRoot "/Users/christos/websites/bible"
    <IfModule dir_module>
        DirectoryIndex index.cgi index.php index.shtml index.html
    </IfModule>
    <FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
        Require all denied
    </FilesMatch>
    <Files "rsrc">
        Require all denied
    </Files>
    <DirectoryMatch ".*\.\.namedfork">
        Require all denied
    </DirectoryMatch>
    ErrorLog "/private/var/log/apache2/multipurpose_error_log"
    LogLevel warn
    <IfModule log_config_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
        LogFormat "%h %l %u %t \"%r\" %>s %b" common
        <IfModule logio_module>
          LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>
        CustomLog "/private/var/log/apache2/access_log" combined
    </IfModule>
</VirtualHost>

Service on port 80 is problematic. It should be serving up content that I've created, but it just displays an "It worked!" page, and I'm not sure where it's getting that from. There is a /Library/WebServer/Documents/index.html.en that could have accounted for "It worked!" but when I made a trial change to that file and reloaded the page source; the change didn't show up.

I've tried a few variants, and I cannot establish a connection on port 7000.

Apache has in the past correctly displayed material from /Users/christos/link, but I'm almost wondering if I'm editing a wrong file or something like that.

Advice?

TIA,

3
  • When you remove/rename the index.html.en page, do you still get the page being loaded? Caching is a real pain in the butt from some browsers and has caused confusion for me a number of time. As for the 7000 port, are you able to connect using curl or wget on the server directly? – Jason K. Apr 1 '17 at 17:24
  • Are you testing with addresses such as swissarmyknife.localdomain or biblesearch.localdomain:7000 ? (and appropriate name resolution to resolve those URLs to your Mac's IP address). – Brandon Xavier Apr 1 '17 at 21:49
  • @BrandonXavier I was testing against localhost (my bad), but an updated /etc/hosts file is specifically directing foo.localdomain-type hostnames to 127.0.0.1 – Christos Hayward Apr 2 '17 at 18:50
0

I was wrong about one not-so-little detail: my Apache installation was under /usr/local, so Homebrew (probably) is serving up Apache, instead of Mac's default install. When I edited the index.html under the DocumentRoot specified and reloaded from viewing the source, the change appeared immediately.

(Probably a better arrangement, as in the past upgrading to the latest OSX release has consistently meant re-adding changes to Apache installation that have been clobbered by an upgrade that assumes that no interesting customization will be present WRT Apache.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.