Error installing and starting Apache Web Server using Gzip Compression - apache

I tried to install the Apache 2.4 web server on my local machine and I got the error below.
**
Errors reported here must be corrected before the service can be started.
AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name, using fe80::7908:85c9:d022:6dbc. Set the 'ServerName' directive globally to suppress this message**
I ran the command httpd.exe -k install to install the Apache and httpd.exe -k start to start the server and see if I could bypass error.

You need to set a Server Name in the httpd.conf :
List item C:\Apache24\conf\httpd.conf or /usr/local/apache2/conf/httpd.conf with notepad or any other text editor.
Search for this line in config file #ServerName www.example.com:80
Uncomment this line by removing # from the first of line and edit to ServerName 127.0.0.1
Save the file, exit and try restarting the server
Source : Could not reliably determine the server's fully qualified domain name

So, I came across a doc online that fixed the error.
All that was needed to find the line with #ServerName www.example.com:80 in C:\Apache24\conf\httpd.conf, uncomment it, and maybe replace the URL with 127.0.0.1 or as it suits.
Link to the document:
https://monovm.com/blog/apache-could-not-determine-the-server-qualified-domain-name/

Related

Global ServerName directive returns Syntax Error

I am trying to configure an Apache2 Server, I ran the command to check its status and got the error that my global serverName is not set, so I googled how to do it and it worked fine, I opened the apache2.conf file and put in the server name I got through running this:
hostname and then I put in the server IP, as seen here:
# Global configuration
#
lehner-tse01 132.231.36.101
However when I run apachectl configtest or when I try to restart apache I get this error:
Invalid command 'lehner-tse01', perhaps misspelled or defined by a module not included in the server configuration
I cant rename the server and I didn't find anything googling for the second part of the error message.

Apache2 Problems after updating OSX to High Sierra

For the week I have had major issues with Apache. My development environment on my mac stopped working after I updated to High Sierra. I tried for hours fixing this myself but couldn't find a solution.
Server version: Apache/2.4.29 (Unix)
Basically what is happening, whenever I try to restart apache I get this message:
AH00558: httpd: Could not reliably determine the server's fully
qualified domain name, using 10.0.0.50. Set the 'ServerName' directive
globally to suppress this message
I have tried a ton of different ways of configuring my vhosts file as well as my httpd config but have seen no improvement.
The document root path was not pointed where my website existed before. After finding that out and pointing it at the correct location the "It Works!" message I was getting every-time disappeared and now I am only greeted with a message that says
Not Found
The requested URL / was not found on this server.
This message happens no matter what path I put for the DocumentRoot section so I'm not sure what the real problem is.
Also, I have my apache set up to use localhost, however it continues to use 10.0.0.50 as it's IP of choice. I have never seen this IP before and I am confused on where it came from.
TLDR: I am having tons of problems with apache after updating to High Sierra, have tried to uninstall/reinstall. Apache is using 10.0.0.50 as the IP, DocumentRoot seems to have problems, config seems to be messed up.
Check configuration:
httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.79. Set the 'ServerName' directive globally to suppress this message
Syntax OK
To fix that:
sudo vi /etc/apache2/httpd.conf
Before:
ServerName www.example.com:80
After:
ServerName localhost
Check configuration again:
httpd -t
Syntax OK

Apache 2 - AH02311: Fatal error initialising mod_ssl

I'm trying to set up a Godaddy SSL certificate on a DigitalOcean droplet running Ubuntu with Apache 2. After I've configured the certificates correctly (to the best I can see & according to the following articles:
https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-16-04#step-2-configure-apache-to-use-ssl
https://www.digicert.com/ssl-certificate-installation-ubuntu-server-with-apache2.htm
https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
I cannot run Apache and I'm getting the following error:
AH02311: Fatal error initialising mod_ssl
I've also seen this error:
SSL Library Error: error:0B080074:x509 certificate routine
both of these are in the error.log file.
Looks like private key is not matching certificate check on that (Not sure as i do not see full console logs). I hope the cert order is correct it should be
SSLCertificateFile /etc/apache2/ssl/certificate.crt
SSLCertificateKeyFile /etc/apache2/ssl/private.key
SSLCACertificateFile /etc/apache2/ssl/intermediate.crt
Usually this is an apache.conf configuration error or any other configuration file. do this:
purge ApacheUninstall/Purge Apache
reload modules
reboot server
do apachectl configtest
sudo systemctl restart apache2.service
sudo systemctl status apache2.service
That should fix the problem.
I was able to reproduce this exact error condition by simply enabling SSL under apache (by uncommenting the line in httpd.conf that loads mod_ssl and mod_socache_shmcb.so). The default httpd-ssl.conf file contains example lines of configuration with dummy values. Specifically there is a virtual host block at the bottom of this file that is provided as a template. It contains uncommented lines with dummy values. Apache won't accept these values as they are.
To test this, uncomment the above modules in httpd.conf open a console window, go to the apache\bin folder (the apache folder will have the appropriate version appended like apache2.37)
and type
httpd -t
And apache will validate your .conf files and report fatal errors. The first one you will see will report that it is unable to find server.crt. If you fill in the entire section with the values for the website that you are trying to secure apache should stop throwing these errors.
for more detail when troubleshooting use
httpd -e warn
or
httpd -e debug
To set up a secure virtual host for a site example.com you need two blocks.
One insecure block, and one insecure block. The insecure block uses port 80 or whatever port you choose if 80 is in use elsewhere. This is usually set up in the httpd-vhosts.conf file. The secure block is copy of the insecure block with the added commands for configuring SSL and uses port 443. This block is usually placed in httpd-ssl.conf Https-ssl.conf is automatically included in httpd.conf which is the master configuration file. It contains a conditional clause which detects the mod_ssl module and loads httpd-ssl.conf if the module is loaded. This is why the error occurs as soon as mod_ssl is enabled.
I was also having the same problem.
While checking, I found it was due to wrong passphrase in pass.out file.
It was solved after correcting that, so I suggest you to check that as well.

Is it possible to check a .htaccess file using the -t option of the apache2 command?

I've got a .htaccess file that I copied from one Apache HTTPD server and deployed onto another. Unfortunately, I foolishly didn't check the version of the destination server and just put the file in place; the site stopped working because it's Apache 2.4 and the file has 2.2 syntax. So I quickly reverted it to the previous version and hoped that nobody noticed!
Now, of course, I'm paranoid.
I tried copying the broken-on-2.4 version elsewhere and using apache2 -t .htaccess to find out what's wrong, but I get this error:
apache2: Could not open configuration file /etc/apache2/.htaccess: No such file or directory
If I supply the full path (i.e. apache2 -t /path/to/it/.htaccess) I get:
AH00534: apache2: Configuration error: No MPM loaded.
This error appears to be unrelated but I get the same error message and exit code (1) regardless of whether or not there's an error in the .htaccess file.
So my question is: can I use apache2 -t [...] to test a .htaccess file, and if not, what can I use instead (aside from the manual)? There is this site but it doesn't seem to allow me to say what version of Apache to check against.
I haven't found out how to do what I asked, but I have come up with a workaround.
I created a new directory on the server and put the incompatible .htaccess file in there. I then accessed the directory via my browser whilst tail -fing the error log (/var/log/apache2/error.log) to see what the problem was.

The Requested Operation has failed- Apache error

When I'm trying to start the Apache 2.2 server it is showing the following message: The Requested Operation has failed
In command Prompt it is showing as follows:
C:\Documents and Settings\amth>net start apache2.2
The Apache2.2 service is starting.
The Apache2.2 service could not be started.
A service specific error occurred: 1.
More help is available by typing NET HELPMSG 3547.
Open run( win + r ) in windows and then type services.msc. Search for Apache service. Double click on the service and select any startup type other than disabled. This should work like a charm.
Open conf folder then open httpd.conf file in your text editor.
Find this line:
Listen 12.34.56.78:80
Listen 80
and change it to
Listen 12.34.56.78:80
Listen 8080
Then hit save
I have wasted a whole day on figuring out why curl_init() threw an undefined-error. Im using Windows, Apache 2.4 and PHP 7.3
After trying to:
Install a fresh version of Curl As described in this post
Enabe Curl in the php.ini file following this description
I still got this error.
The solution was to add the directory of the php e.g c:php/ to the PATH Variable in the Windows environment variables.
->Hit the Windows-Key and S
-> search for "System"
-> go to advanced options(a small window shuld pop up)
-> hit environment variables
-> in the **bottom** box scroll until you find "PATH"
-> select it and hit "edit"
-> enter the php directory and close the window
-> reboot your PC
Hopefully it will work for you too :)
Have you done any changes in httpd.conf file ? i was also facing same problem in my case i have saved httpd.conf file as txt so due to that i was getting error
Was getting this issue when trying to start Apache with mod_jk. As part of loadmodule in http.conf file LoadModule jk_module modules/mod_jk.so was added but in Apache2.2\modules folder mod_jk.so file was not available. Added mod_jk.so file to modules folder and apache started without any issues.
Here is what I did - if you uninstall and reinstall apache via command prompt it
httpd -k unistall/httpd -k install
then it displays the errors
in my case the require all was missing 'granted' at the end of to look like 'require all granted'
<Directory />
AllowOverride all
Require all
</Directory>
If your lan ip changed then you would come across this error. In the httpd conf file you to rectify the following:
Listen IP:Port
I ran into the same error message on Windows Server 2008 R2. I was using SSL and realized that my signer certs, configured in ssl.conf, where placed in the wrong folders on the file system. I placed the certs in the correct spot and the service and Apache was working fine afterwards.
I've tried closing World Wide Web services, changing a lot of ports and surfing many forums, and eventually I looked in to Logs=>Apache (error.log) files.
I saw in this error:
PHP Fatal error: Directive 'asp_tags' is no longer available in PHP in Unknown on line 0
Then I opened php.ini files in XAMPP. Find with ctrl+f asp_tags=On line and turn it to Off.
All of it then worked.
In my case Apache 2.4 is worked on Win7Pro 64bit. Last week it worked fine but today I was unable to start it as usually. I tried to check logs for errors but no clue. Then I went to Control panel -> Administrative tools -> Services and found there Apache service was disabled!? Click on property, set Startup type to manual and - voila! It started like charm.