ERR_TOO_MANY_REDIRECTS issue after Magento2 install, possible Ubuntu virtual host issue - apache

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.

Related

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

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.

Setting up LAMP on VPS, virtual host not working

Trying to set up a sample site on a VPS with LAMP.
Accessing the site via IP address loads it fine, but I'd like to make it work with the URL "mysite.dev". However when I go to http://mysite.dev in Chrome, I get "This site can’t be reached. mysite.dev refused to connect."
I followed instructions from this article and the configtest is OK: https://linuxize.com/post/how-to-set-up-apache-virtual-hosts-on-ubuntu-20-04/
Port 80 is open.
I did notice when I enter http://mysite.dev in Chrome, it replaces it with https and I can't get that to turn off. Not sure if that's the problem.
Here is the config setup:
/etc/apache2/sites-available/mysite.dev.conf:
<VirtualHost *:80>
ServerName mysite.dev
ServerAlias www.mysite.dev
ServerAdmin xxxx#gmail.com
DocumentRoot /var/www/mysite.dev/public_html
<Directory /var/www/mysite.dev/public_html>
Options -Indexes +FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mysite.dev-error.log
CustomLog ${APACHE_LOG_DIR}/mysite.dev-access.log combined
</VirtualHost>
My local /etc/hosts file:
123.123.123.123 mysite.dev
123.123.123.123 www.mysite.dev
Any help is appreciated.
Figured it out. Chrome forces all .dev domains to use HTTPS, which I hadn't configured. Changed to use a different TLD and all is good.

403 Error - Apache VirtualHost - Ubuntu 22.04

i recently install ubuntu 22.04 and try to use LAMP on it.
but i have problem with VirtualHost.
i want use virtualhosts with a local domain like: test.local
i added this domain to /etc/hosts and add this configuration to my test.local.conf:
<VirtualHost *:80>
ServerName test.local
ServerAdmin webmaster#localhost
DocumentRoot /home/soroush/Sites/test
<Directory "/home/soroush/Sites/test" >
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
and then run: a2ensite test.local.conf
but when i open test.local in my browser, apache show me a 403 error.
Sites/test folder and files have 0777 permission and owner is my username.
what i should to do for fix this problem?
By default, Ubuntu does not allow access through the web browser to
any file apart of those located in /var/www, public_html directories
(when enabled) and /usr/share (for web applications). If your site is
using a web document root located elsewhere (such as in /srv) you may
need to whitelist your document root directory in
/etc/apache2/apache2.conf. The default Ubuntu document root is
/var/www/html. You can make your own virtual hosts under /var/www.
This is different to previous releases which provides better security
out of the box.
To solve the problem:
Move your source code to /var/www
Example: /var/www/site
2.Fix your Virtualhost
<VirtualHost *:80>
ServerName test.local
ServerAdmin webmaster#localhost
DocumentRoot /var/www/site
<Directory "/var/www/site" >
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Add your user to the apache group then it's working fine
sudo usermod -g www-data <YOUR_USERNAME>
my soluttion was a downgrade to 20.04 ;) sorry if I can't give you a better solution.

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

Virtual Host on CentOS5

I'm trying to add a new virtual host to a CentOS 5 box.
I've added a new section in virtualhost.conf matching existing entries:
<VirtualHost ip address:80>
ServerAdmin email#email.com
DocumentRoot /home/stuff/public_html
ServerName stuff.stuff.com
ErrorLog /var/log/httpd/stuff.stuff.com-error_log
CustomLog /var/log/httpd/stuff.stuff.com-access_log combined
<Directory /home/stuff/public_html>
Options All
AllowOverride All
</Directory>
<IfModule mpm_itk_module>
AssignUserId stuff stuff
</IfModule>
</VirtualHost>
I then do a reload using the command: /etc/init.d/httpd reload
I've put a placeholder index.php in the directory, and would expect to see an "it works" when visiting the domain, but instead Chrome shows "ERR_NAME_NOT_RESOLVED"
What steps am I missing here? (I'm used to working in a windows environment, this is my first real encounter with CentOS)
Resolved this as a DNS issue, resolved locally editing hosts to match the IP.