1

I just managed to get Laravel Valet installed and working on my machine running Mojave 10.14.2.

I'd like to use Valet for Laravel projects, however, I have other non-Laravel, non-php sites that I'd like to still be able to run using Apache localhost.

The Valet documentation says that no other programs should be running that bind to port 80. So I stopped Apache before installing Valet.

So I changed the /etc/apache2/httpd.conf file from Listen 80 to Listen 8081. I also changed all virtual hosts in my /etc/apache2/extra/httpd-vhosts.conf file from :80 to :8081.

Then, I stopped Valet using valet stop.

Now, when I try to run sudo apachectl restart, I get this message:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Galens-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start

I went back into the httpd.conf file and uncommented ServerName. I've tried setting it to localhost, 127.0.0.1, and 127.0.0.1:8081.

I still can't get this error to go away, and I can't get Apache to run.

I'd like to be able to stop Valet and run Apache from time to time. What else am I missing?

httpd.conf file looks like this (all commented lines removed):


ServerRoot "/usr"

<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
    Listen 8081
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
    Listen 81
</IfDefine>

LoadModule authn_file_module libexec/apache2/mod_authn_file.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule access_compat_module libexec/apache2/mod_access_compat.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
LoadModule filter_module libexec/apache2/mod_filter.so
LoadModule mime_module libexec/apache2/mod_mime.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
LoadModule env_module libexec/apache2/mod_env.so
LoadModule headers_module libexec/apache2/mod_headers.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
LoadModule slotmem_shm_module libexec/apache2/mod_slotmem_shm.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule php7_module libexec/apache2/libphp7.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so

<IfModule unixd_module>

User _www
Group _www

</IfModule>

ServerAdmin you@example.com

ServerName localhost 

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/Users/galen/Sites"
<Directory "/Users/galen/Sites">

    Options FollowSymLinks Multiviews
    MultiviewsMatch Any

    AllowOverride All

    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex 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/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>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "/private/var/log/apache2/access_log" common

</IfModule>

<IfModule alias_module>

    ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"

</IfModule>

<IfModule cgid_module>

</IfModule>

<Directory "/Library/WebServer/CGI-Executables">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule headers_module>

    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>

    TypesConfig /private/etc/apache2/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

</IfModule>

TraceEnable off

Include /private/etc/apache2/extra/httpd-mpm.conf

Include /private/etc/apache2/extra/httpd-autoindex.conf

Include /private/etc/apache2/extra/httpd-vhosts.conf

<IfModule proxy_html_module>
Include /private/etc/apache2/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Include /private/etc/apache2/other/*.conf
Galen
  • 41
  • 1
  • 8
  • Can you provide your `httpd.conf` file (without comments)? – Romeo Ninov Jan 22 '19 at 08:09
  • Here it is (with all commented lines removed) – Galen Jan 23 '19 at 15:02
  • 1
    Also, I just hit on something. I ran `which -a apachectl`, and this returned: `/usr/local/bin/apachectl` `/usr/sbin/apachectl` So now, if I stop valet and run `sudo /usr/sbin/apachectl restart`, it works. I'm not sure how I wound up with two separate instances for apachectl. I'd never installed homebrew until I used it to install valet. Does homebrew create its own instance of apachectl? – Galen Jan 23 '19 at 15:12

0 Answers0