Apache VHost not working but seems to be configured correctly: Mac Os Ventura - apache

The Problem
I've been trying to setup apache on my mac. I installed apache using brew and everything seems to work except when I actually try to navigate the url with my browser.
Anytime I navigate to http://parenting.localhost/ I just get a 404 error. To make things even more odd, if I just go to http://localhost/ (not using the vhost) it still writes the logs to the vhost log files. Clearly something is wrong, I just can't figure it out. Any help would be appreciated.
My Environment
My /usr/local/etc/httpd/extra/httpd-vhosts.conf:
<VirtualHost *:80>
ServerName parenting.localhost
ServerAlias parenting.localhost.com
DocumentRoot "/Users/joshteam/PhpstormProjects/parenting/public"
<Directory /Users/joshteam/PhpstormProjects/parenting/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /Users/joshteam/PhpstormProjects/parenting/storage/logs/error.log
CustomLog /Users/joshteam/PhpstormProjects/parenting/storage/logs/access.log combined
</VirtualHost>
My /etc/hosts:
127.0.0.1 parenting.localhost
127.0.0.1 parenting.localhost.com
I ensure the VHOST is enabled currently:
$ httpd -t -D DUMP_VHOSTS
VirtualHost configuration:
*:80 parenting.localhost (/usr/local/etc/httpd/extra/httpd-vhosts.conf:24)
What I'm Trying To Do
To navigate to http://parenting.localhost/ and for apache to execute the appropriate index.php within the vhost configuration. Instead I get a 404.

Related

Issues with Apache and Virtual Hosts

I'm, trying to run both MediaWiki and Wordpress on an Apache server. I've got the MediaWiki site set up with a couple of sub-domain Virtual Hosts, so everything is fine there. This is installed at /var/www/html/mediawiki.
I'm trying to install Wordpress on it's own directory, /var/www/wordpress.
In my config file for Wordpress' virtual host, I've got:
<VirtualHost *:80>
ServerName domain.com
ServerAdmin admin#domain.com
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/wordpress/> AllowOverride All</Directory>
Obviously domain.com is not the domain.
Whenever I visit domain.com, however, it seems to be loading the MediaWiki install from /var/www/html/mediawiki, which is obviously not what I want.
Anyone got any ideas what I'm doing wrong here?
Run apachectl to see all the servers/vhosts running on your server both port 80 and 443
apachectl -S
Also I believe that:
<Directory /var/www/wordpress/> AllowOverride All</Directory>
should be inside of your virtual host block

Apache - Run site under sub directory (?)

I'm sure it's been answered, but I'm failing to find the right search terms to find the solution.
I have a site (mysite.com) running in Apache, this is working great:
<VirtualHost mysite.com:80>
ServerName www.mysite.com
ServerAlias *.mysite.com
DocumentRoot /var/www/mysite
</VirtualHost>
I would like to run this site one level up in the url, something like this: mysite.com/past/2019
I can't get this to work by modifying the ServerName or ServerAlias values.
For this firstly you have to enable the apache2 rewrite module. You can enable this by running the command 'sudo a2enmod rewrite' after this add below line to your apache2 vhost
<Directory /var/www/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Then restart your apache2 server by running command sudo service apache2 restart
Hope it works for you.

404 Not Found in incorrect Apache configuration

I have a problem that apache configuration. Here my virtual host setting.
<VirtualHost *:80>
ServerName orocrm.75cl.sg
DirectoryIndex app.php
DocumentRoot /var/www/html/oro/web
<Directory /var/www/html/oro/web>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
But, when I access to other menus, http://orocrm.75cl.sg/oro/web/app.php/ is always shown in front of the my targeted menu. So, it was shown 404 page. e.g http://orocrm.75cl.sg/oro/web/app.php/magento/cart/. It should be like that http://orocrm.75cl.sg/app.php/magento/cart/
May I know how do I fix this issue.
I recall that some versions of Apache come with a pre-configured vhost to point to the welcome.conf and such.
So I would suggest commenting the welcome.conf which is at /etc/httpd or on some distros /etc/apache2 and in those same directories find and remove any installation virtual hosts.
After that you should be free of conflicts as the pre defined virtualhost is like follows:
<VirtualHost *:80>
DocumentRoot "/var/www/welcome"
And that is all I can remember from last time looking at the file.
Enjoy

Apache won't start with added VirtualHost, but gives no error in error log

I am using EasyPHP (version 16.1.1) for Apache server (installed version 2.4.18 x86). I need to add a new VirtualHost, so now the whole VirtualHost section of httpd.conf looks like this:
# VIRTUAL HOSTS
## Virtualhost localweb
<VirtualHost 127.0.0.1>
DocumentRoot "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www"
ServerName 127.0.0.1
<Directory "C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www">
Options FollowSymLinks Indexes ExecCGI
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:8080>
UseCanonicalName Off
ServerAdmin marekbuchtela#gmail.com
ServerName posis
ServerAlias posis.tovarna
VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"
</VirtualHost>
The first one is the default one made by EasyPHP, the second one is added by me. However in this setup, the Apache won't start. When I remove the second VirtualHost, everything works fine, but with it, it just won't start at all. I have checked the error log and there is no output at all.
Any ideas why is this happening/how to fix it?
Thanks
Switch VirtualDocumentRoot "C:\Users\marek\is\tovarna\public"for DocumentRoot "C:\Users\marek\is\tovarna\public"
If by any chance you keep getting the error, show error_log output
There is another instance other than the answer given by ezra-s as to why EasyPHP server won't start and the Apache error log is empty.
When declaring paths in the vhosts file, it is important that the directories referenced in those paths exist. If you provide the following VirtualHost information, for example:
<VirtualHost *:80>
DocumentRoot "D:/MyApp/public_html"
ServerName myapp.local
ErrorLog "D:/MyApp/logs/error.log"
CustomLog "D:/MyApp/logs/apache.log" common
</VirtualHost>
...but you don't have a D: drive, or the directories D:/MyApp/ and D:/MyApp/logs/ don't exist, then you'll get a "silent fail" in Apache when starting the HTTP server from the EasyPHP console.

ERR_TOO_MANY_REDIRECTS issue after Magento2 install, possible Ubuntu virtual host issue

I installed Magento2 on Ubuntu 14.04 following [Magento's sets of instructions][1]:
After getting [SUCCESS]: Magento Installation Complete. the site should work, but getting ERR_TOO_MANY_REDIRECTS error.
I suspect a misconfiguration of Virtual Hosts as there are a few sites on this server.
nfcshop.ca.conf file below from sites-available and is linked in sites-enabled
<VirtualHost *:80>
ServerName nfcshop.ca
ServerAlias nfcshop.ca
ServerAdmin admin#nfcshop.ca
DocumentRoot /var/www/magento
Redirect permanent / http://nfcshop.ca/
ErrorLog ${APACHE_LOG_DIR}/shop-error.log
CustomLog ${APACHE_LOG_DIR}/shop.log combined
<Directory /var/www/magento/>
AllowOverride All
</Directory>
</VirtualHost>
I put a .htaccess file in var/www/magento
Order deny,allow
Deny from all
service apache2 restart is [OK]
I tried different browsers and clearing cache and cookies to no avail.
All the other sites on the same server are still working. Not sure what I am missing. Thank you!
For me, removing the line
Redirect permanent / http://nfcshop.ca/
worked.
I got the error ERR_TOO_MANY_REDIRECTS because I forgot to set the PHP version to PHP7.