How do I change my DocumentRoot when using the Homebrew Apache/httpd?

I’m using the Homebrew version of Apache/httpd. I’ve disabled the Mac OOTB version.

If I disable/comment the following, my localhost correctly brings up index.html from /Users/lamba/www/index.html.

Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

However, when I uncomment it, I get an ERR_CONNECTION_REFUSED error in the browser (Chrome). I don’t see anything useful in the logs, even with trace8 level logging.

I have granted r access to all users for /Users/lamba/www and down. And r, x access to all users for /Users/lamba/Projects and down (I thought index.php might need x access).

Important parts of my Apache/httpd configuration:

httpd.conf

Listen 80
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
LoadModule php_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp.so
DocumentRoot "/Users/lamba/www"
<Directory "/Users/lamba/www">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

httpd-vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/lamba/Projects/Magento-Open-Source/pub"
    ServerName local.m2os.com
    ErrorLog "/usr/local/var/log/httpd/m2os-error_log"
    CustomLog "/usr/local/var/log/httpd/m2os-access_log" common
        <Directory "/Users/lamba/Projects/Magento-Open-Source/pub">
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        Header always set Strict-Transport-Security "max-age=0"
        DirectoryIndex index.php
</VirtualHost>

/etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
127.0.0.1       local.m2os.com
255.255.255.255 broadcasthost
::1             localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
127.0.0.1 ::1 magento.test

After some more consideration, I think this is not a virtual host issue because (after disabling virtual hosts) I am not able to point my localhost to my real project’s root either. My project root has an index.php file, which the log indicates Apache is able to find. But then for some reason it sends a 302 response instead of executing the script. Before I had included the PHP module, it was displaying the contents of login.php and again not executing it. I would still appreciate help figuring out how to get Apache to execute index.php. Also, I have added index.php to the DirectoryIndex directive.

An even more pointed question to ask is, how do I change my DocumentRoot? I’ve set the DR to /Users/lamba/Projects/Magento-Open-Source/pub in /usr/local/etc/httpd/httpd.conf. However, when I run “brew info httpd”, it reports the default DR /usr/local/var/www. So, I’m guessing that is the source of my troubles. How do I change that?

The master conf in the pre-Homebrew world used to be 000-default.conf. Where is that file in the Homebrew world?

UPDATE: If I hide index.php, Apache successfully loads index.html from the same location. So, it appears to be a PHP issue.

UPDATE 2: I created a simple dummy index.php in my pub folder and Apache is serving it up just fine. So, I believe this to now be a Magento issue (with Magento’s index.php). Still digging.

Finally got the admin page to load by switching to Nginx. Nginx has better error logging, which helped me figure out that the issue was an untrusted SSL certificate. So I added it as trusted. The admin page is showing a 404 for some of the content due to a “mixed content” error, meaning some content on an HTTPS page is being fetched via HTTP. The storefront home page still isn’t loading, with the error “Redirected you too many times. Try deleting your cookies.”

Fixed the “mixed content” issue by disabling the CSP mod for now. Not sure why these issues should be popping up OOTB though. Feedback and comments welcome.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

How do I change my DocumentRoot when using the Homebrew Apache/httpd?

I’m using the Homebrew version of Apache/httpd. I’ve disabled the Mac OOTB version.

If I disable/comment the following, my localhost correctly brings up index.html from /Users/lamba/www/index.html.

Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

However, when I uncomment it, I get an ERR_CONNECTION_REFUSED error in the browser (Chrome). I don’t see anything useful in the logs, even with trace8 level logging.

I have granted r access to all users for /Users/lamba/www and down. And r, x access to all users for /Users/lamba/Projects and down (I thought index.php might need x access).

Important parts of my Apache/httpd configuration:

httpd.conf

Listen 80
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
LoadModule php_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp.so
DocumentRoot "/Users/lamba/www"
<Directory "/Users/lamba/www">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf

httpd-vhosts.conf

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/Users/lamba/Projects/Magento-Open-Source/pub"
    ServerName local.m2os.com
    ErrorLog "/usr/local/var/log/httpd/m2os-error_log"
    CustomLog "/usr/local/var/log/httpd/m2os-access_log" common
        <Directory "/Users/lamba/Projects/Magento-Open-Source/pub">
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        Header always set Strict-Transport-Security "max-age=0"
        DirectoryIndex index.php
</VirtualHost>

/etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
127.0.0.1       local.m2os.com
255.255.255.255 broadcasthost
::1             localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
127.0.0.1 ::1 magento.test

After some more consideration, I think this is not a virtual host issue because (after disabling virtual hosts) I am not able to point my localhost to my real project’s root either. My project root has an index.php file, which the log indicates Apache is able to find. But then for some reason it sends a 302 response instead of executing the script. Before I had included the PHP module, it was displaying the contents of login.php and again not executing it. I would still appreciate help figuring out how to get Apache to execute index.php. Also, I have added index.php to the DirectoryIndex directive.

An even more pointed question to ask is, how do I change my DocumentRoot? I’ve set the DR to /Users/lamba/Projects/Magento-Open-Source/pub in /usr/local/etc/httpd/httpd.conf. However, when I run “brew info httpd”, it reports the default DR /usr/local/var/www. So, I’m guessing that is the source of my troubles. How do I change that?

The master conf in the pre-Homebrew world used to be 000-default.conf. Where is that file in the Homebrew world?

UPDATE: If I hide index.php, Apache successfully loads index.html from the same location. So, it appears to be a PHP issue.

UPDATE 2: I created a simple dummy index.php in my pub folder and Apache is serving it up just fine. So, I believe this to now be a Magento issue (with Magento’s index.php). Still digging.

Finally got the admin page to load by switching to Nginx. Nginx has better error logging, which helped me figure out that the issue was an untrusted SSL certificate. So I added it as trusted. The admin page is showing a 404 for some of the content due to a “mixed content” error, meaning some content on an HTTPS page is being fetched via HTTP. The storefront home page still isn’t loading, with the error “Redirected you too many times. Try deleting your cookies.”

Fixed the “mixed content” issue by disabling the CSP mod for now. Not sure why these issues should be popping up OOTB though. Feedback and comments welcome.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật