简体   繁体   中英

Apache is using a different port and Document Root than is in the config file

I am trying to get apache running locally with php, but for some reason, my apache is running on port 8080 instead of port 80 and it is using a different document root than is defined in the httpd.conf

When I run /usr/sbin/httpd -V it tells me where my server config file is -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

I went to that file and it has this for Listen :

<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
    Listen 8080
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
    Listen 80
</IfDefine>

And this for document root: DocumentRoot "/Library/WebServer/Documents"

apachectl -S also says Main DocumentRoot: "/Library/WebServer/Documents" Earlier today it was saying /usr/local/var/www but i fixed that, but apache is still using /usr/local/var/www as the document root. Any ideas on what's causing this? My apache server is also not running the php it is just showing as plain text, not sure if that is related or not

Finally figured it out, I ran /usr/local/opt/httpd/bin/httpd -V | grep SERVER_CONFIG_FILE /usr/local/opt/httpd/bin/httpd -V | grep SERVER_CONFIG_FILE and that gave me -D SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf" which was the actual config file it was using, I fixed that one and now its working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM