配置Apache本地主机以在安装了Laravel Valet的情况下运行

时间:2019-01-21 23:52:18

标签: apache localhost valet

我刚设法安装Laravel Valet并在运行Mojave 10.14.2的计算机上工作。

我想将Valet用于Laravel项目,但是,我还有其他一些非Laravel,非PHP站点,我希望它们仍可以使用Apache localhost运行。

代客文档说,没有其他程序可以运行绑定到端口80的程序。因此,我在安装代客之前停止了Apache。

因此,我将/etc/apache2/httpd.conf文件从Listen 80更改为Listen 8081。 我还将/etc/apache2/extra/httpd-vhosts.conf文件中的所有虚拟主机从:80更改为:8081

然后,我使用valet stop停止了Valet。

现在,当我尝试运行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。我尝试将其设置为localhost127.0.0.1127.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

0 个答案:

没有答案