Firstly I've read many tutorials, I'm trying for many hours during last days (because I know there were billion similar questions and tutorials for the same thing before) but I'm in the ends... :-(
The last site I've followed (and checked many times) was https://tech-cookbook.com/2020/11/14/setting-up-your-local-web-server-on-macos-big-sur-11-0-1-2020-mamp-macos-apache-mysql-php/. Before I've tried https://medium.com/nerd-for-tech/how-to-run-apache-php-on-mac-os-big-sur-7ffbf7cbef7b, but they looks very similar.
What I have
Apache 2.4.46 (apachectl -v)
php 7.3.24 (php -v)
Apache should be setted correctly. Stopped and started.
sudo apachectl configtest
returns Syntax OK
in /etc/apache2/httpd.conf
I have set DocumentRoot
and <Directory ...
to /Users/username/Sites/
/Users/username/Sites
has chmod 777
/Users/username/Sites
shows me directory content (path is correct)
/etc/apache2/extra/httpd-vhosts.conf
is set to (source https://wpbeaches.com/set-up-virtual-hosts-on-macos-big-sur-11-in-apache/)
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/username/Sites/
# I've tried:
## insert value into "",
## localhost,
## localhost/~username,
## set localhost and ServerAlias to localhost/~username, etc.
</VirtualHost>
Result
As result, both http://localhost
and http://localhost/~username
returns me ERR_CONNECTION_REFUSED
.
I've checked all .conf
files settings with my older macbook and they look very similar in both machines... :-(
Any idea where could be problem? I'm able to put here more additional information (copy conf files content, whatever) if needed... I'm a little bit hopeless... :-(
Thanks!
EDIT
ps -ax | grep '[h]ttpd'
returns
14994 ?? 0:00.51 /usr/sbin/httpd -D FOREGROUND
14997 ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
15002 ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND
15040 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
15042 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
15043 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
sudo lsof -a -iTCP -sTCP:LISTEN -c httpd
returns
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 14994 root 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)
httpd 14997 _www 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)
httpd 15002 _www 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)
httpd 15040 _www 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)
httpd 15042 _www 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)
httpd 15043 _www 4u IPv6 0xbbfd6axxxxxxxxxx 0t0 TCP *:http (LISTEN)