last day (15 days later) » 

4:13 PM
0
A: err_too_many_redirects when trying to redirect non www to www

StefanTo resolve your problem you have to understand the concept of 'NameVirtualHosting' and Ubuntu's special way of deploying the apache web service. NameVirtualHost Your (local) apache webserver can serve different web sites on the same adress as long as they are 'named' differently. The webserver ...

 
I copied and paste the all code you gave me by removing example.com - in 000-default.conf but I get this message when trying to restart -- Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
 
You can check the apache configfile with /usr/sbin/httpd -f /etc/apache2/apache2.conf -t. (I am asume your httpd binaries are at /usr/sbin; if not try locate httpd) If you are comfortable with systed you could use journalctl to output the system start messages of httpd)
 
My config file is located at /etc/apache2/apache2.conf I don't have httpd file when I try to search. What should I change in the confing file. Also I have directory usr <Directory /usr/share> AllowOverride None Require All Granted </Directory> and there are many other things, What should I change there?
Also when I run this systemctl status apache2.service I get this see the screenshot ibb.co/fuE9Gb | When I run this journalctl -xe I get this ibb.co/irYVNG
I only get err_to_many_redirect when I run not the code you gave me.
 
In the 1st screenshot you can see: line 42 of 000-default.conf: invalid command '...' - : You have to substitute the three dots in my code with the actual configuration of your www- VirtualHost ;-).
 
What should I write to 3 ... , can you give an example, don't understand it?
I substituted the 3 ... with DocumentRoot /var/www/ and also DocumentRoot /var/www/html/don't know if this is the actual configuration of www virtual host. And I got err_to_many_redirects. Also using this ErrorLog /var/log/httpd/error-non-www-example.log Loglevel warn rewrite:debug` I get the same error with 3 ...
 
4:13 PM
Hi, to be able to help I would need to see the whole apache config under /etc/apache2 as there seemed to be a logical misconfiguration. Also, to check, that you start the correct config please do ps auxw | grep httpd | grep root. You should see something like root 2434 0.0 0.0 90788 7836 - SsJ 12:10 0:00.02 /usr/local/sbin/httpd -f /etc/apache2/apache2.conf -k start or there about. The important part is the option -f configfile. I need this informatio as well.
 
Here it is my apache2.conf file pastebin.com/ewDE30D8
 
Hi Mark, when you parse the main apache config file, you notice a couple of IncludeOptional directives; the most important ones concerning your problem are IncludeOptional conf-enabled/*.conf and specifically IncludeOptional sites-enabled/*.conf. Please list all files in the subdirectories sites-enables/ and conf-enabled/ under /etc/apache2. To solve your problem we will need to parse through the sites-enabled/*.conf files one by one.
 
I don't know the commands to find those 3 files and get inside subdirectories. Can you give me a little help, I am a complete newbie.
 
On a command line you would simply type ls -al /etc/apache2/conf/sites-enabled/. (You have to open a 'Terminal Window or Terminal Launcher or xterm' to get a command line ;-)
In a terminal window you can display the content of a text file with cat; e.g. cat /etc/apache2/sites-enabled/000-default.conf.
 
Sorry for the delay, I think i found and I am trying to copy, I will post in 5 minutes
using this command sudo nano /etc/apache2/conf-enabled/*.conf pastebin.com/T1PPp09V || Note: that this file when I will try to close will show different files, I have given this }}}}}}}} to separate them
using sudo nano /etc/apache2/sites-enabled/000-default.conf/ I get this pastebin.com/gSYfZ39Z
 
4:13 PM
OK; is the 000-default.conf the only file in the sites-enabled/ directory? If so we should be nearly there. I assume your website content resides in DocumentRoot /var/www/html?
 
Yes my website is located DocumentRoot /var/www/html I have only 1 website on server and is located sites-enabled/000-default.conf/ but I am going to post also some other apache mods
Using this command sudo nano /etc/apache2/mods-enabled/*.conf I get some files pastebin.com/Ztr9mqdJ
Also when I run this command ls -l /etc/apache2/ ibb.co/dA607G
 
pls see my newly edited answer and send me the output of journalctl -xe after the restart of the apache service.
 
This is the result pastebin.com/2i2PgULx
This is journalctl -xe pastebin.com/RgXe9zb7
 
please try without the NameVirtualHost *:80 line or put your webservers ip address instead of the asterik. (nb: NameVirtualHost is only needed for apache httpd 2.2 or below) and paste the output of systemctl restart apache2.
 
When I put IP address I get this Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details. When I remove NameVirtualHost *:80 I get err_to_many_redirects
Hey Stefan, thank you very much for taking your time to help me in this extended way. Few people would have done what you did, thanks again. I would say also that I have incorrectly set up apache since the start, because what you and others confirm works without doubt. I was able to resolve the problem by only setting www in wordpress setting url. Thanks again for giving so many answers. ------ Also, my apache conf file shows in red, do you think that's a problem ---- check this link ibb.co/gHO3xR
 
 
3 hours later…
7:00 PM
On the first look, you seem to be missing /etc/apache2/sites-available/.
 

  last day (15 days later) »