我刚刚设法安装了 Laravel Valet 并在我的运行 Mojave 10.14.2 的机器上工作。
我想将 Valet 用于 Laravel 项目,但是,我还有其他非 Laravel、非 php 站点,我希望它们仍然能够使用 Apache localhost 运行。
Valet 文档说不应该运行绑定到端口 80 的其他程序。所以我在安装 Valet 之前停止了 Apache。
所以我将 /etc/apache2/httpd.conf 文件从 更改Listen 80
为Listen 8081
. 我还将 /etc/apache2/extra/httpd-vhosts.conf 文件中的所有虚拟主机从:80
更改为:8081
.
然后,我停止使用valet stop
.
现在,当我尝试运行时sudo apachectl restart
,我收到以下消息:
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
我回到 httpd.conf 文件并取消注释ServerName
。我尝试将其设置为localhost
、127.0.0.1
和127.0.0.1:8081
。
我仍然无法让这个错误消失,也无法让 Apache 运行。
我希望能够不时停止 Valet 并运行 Apache。我还缺少什么?
httpd.conf 文件看起来像这样(删除了所有注释行):
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