Failed to start apache Can't open /etc/apache2/envvars - apache

I wanted to install httpd-2.2.32. So I downloaded it from this link and installed it with the help of this guid.
It installed successfully and start it using this command,
sudo systemctl start apache2.service
but, I run below status command,
sudo systemctl status apache2.service
An error occurs as Can't open /etc/apache2/envvars
And localhost won't open
please help me to fix it

Related

Can't stop Apache using homebrew commands

I'm building a new web server on a new M1 Mac Mini running the latest version of Big Sur, fresh install. Only thing I have done to the machine is install Chrome.
I'm installing Apache with the following:
Install xcode command line tools: xcode-select --install
Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install missing libraries: brew install openssl
Check to see if apache is running, remove any scripts:
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
Install httpd: brew install httpd
Configure autostart: brew services start httpd
At this point, httpd is running fine, and I can see the pages at http://localhost:8080
And I can confirm httpd starts up fine after reboot.
Issue is, I can't shut it down. if i issue the command brew services stop httpd, I get the following:
Mac-mini / % brew services stop httpd
Stopping httpd... (might take a while)
==> Successfully stopped httpd (label: homebrew.mxcl.httpd)
Mac-mini / %
Activity monitor still shows multiple instances of httpd running, though.
The only way to shut it down is either quit it in actvity monitor or issue the command
sudo apachectl -k stop
Any suggestions of why niether of the following commands work or how to track down the issue?
brew services stop httpd
brew services restart httpd

Ubuntu 'Failed to restart apache2.service: Unit apache2.service not found.'

I am using Google Cloud Platform to test out ModSecurity and I am using a tutorial to launch it. However, I need to restart Apache every once in a while. I'm using Ubuntu 18.04. I write sudo systemctl restart apache2, but an error comes back and it says Failed to restart apache2.service: Unit apache2.service not found. What should I do?
Did you install apache2 first ?
sudo apt install apache2
For those who run into the same issue using Debian
I did have apache2 installed and running as was confirmed by apache2.service | loaded active running.
I still tried to install it.
I did also get the same error Failed to restart apache2.service: Unit apache2.service not found
How I got apache2 to restart
Using: Debian (9.13)
sudo service apache2 restart
or by typing
sudo apachectl stop
sudo apachectl start
Type sudo apt install apache2
To start the apache service type
sudo systemctl start apache2
if you tried to install it and still got the same problem , you can update it , try :
apt-get update

apache2: ERROR: Module not properly enabled

I am getting this error:
ERROR: Module wsgi not properly enabled:
/etc/apache2/mods-enabled/wsgi.load is a real file, not touching it
I have this:
USER root
RUN apt-get install -y apache2
RUN a2enmod wsgi
does anyone know what this error would signify?
I can't figure out how to resolve it.
if I forgo the a2enmod wsgi line, then I get:
/usr/lib/apache2/modules/mod_wsgi.so: cannot open shared object file:
No such file or directory
The error means that the file or directory mod_wsgi.so doesn't exist on your server. You may follow the instructions below on how to enable this module.
SSH to your machine.
Once you'r logged in, please execute the following commands below:
$ sudo apt-get install libapache2-mod-wsgi
$ sudo a2enmod wsgi
Please execute the find command to locate the mod_wsgi.so module.
$ sudo find / -name *mod_wsgi.so
You should see this result.
/usr/lib/apache2/modules/mod_wsgi.so
Furthermore, to install apache2 please execute the command below:
$ sudo apt-get install apache2 -y
Hope this information works for you.

Apache: Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

When configure apache2 virtual hosts for ssl/https connection, after adding configuration and enable the configuration with this command " a2ensite pm.university.com.conf " i got this error "Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration". I will answer my own question.
It turned out I did enabled ssl module but i had to do it again and it works, here is the command:
sudo a2enmod ssl
Now restart apache like so service apache2 restart
no more error, FIXED!
sudo a2enmod ssl
and restart the apache service that will do the trick
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
Simply:
This error likely happens on apache if your "virtual host" is trying to use SSL but you did not install SSL module on your apache.
Case 1: For Centos (linux distro), run:
yum install mod_ssl openssh
Case 2: For Ubuntu or Debian (linux distros), run:
sudo a2enmod ssl
And it should install and configure everything (a new file *-ssl.conf should appear in your conf.modules.d folder)
sudo yum install mod_ssl
sudo a2enmod ssl
sudo apachectl restart
When you edit the site configuration file, you have to test the configuration before enabling the site just to ensure its Syntax is correct. Use the command below to test the configuration.
apache2ctl configtest
or
sudo apache2ctl configtest
So if the syntax is correct you get a response similar to the one below
If you get the SSLEngine: Invalid command error then run the following command and go back to step one, solve all Syntax errors until it says Syntax OK.
sudo a2enmod ssl
Restart apache using the following command
sudo apachectl restart
Hopefully that solves the error.
Try following Solution:
Open the file httpd.conf at "your apache folder"/conf
Find the following line using CTRL+f in your text editor: #LoadModule ssl_module modules/mod_ssl.so
Remove the #(uncomment the line)
Save and restart your apache

Why localhost's phpmyadmin is empty with no login window?

I installed phpmyadmin following the instructions here. Installation has completed and I have phpmyadmin inside /usr/share/phpmyadmin and has linked to
sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
But doesn't show anything (the whole page is blank with no login window) when I access to http://localhost/phpmyadmin
What could be wrong?
My os is Ubuntu14.04 and installed Apache 2.4.7.
For those who has similar problem, please follow the steps below.
Please check error at /var/log/apache2/error.log
My error is PHP Fatal error: require_once(): Failed opening required './libraries/php-gettext/gettext.inc' (include_path='.')
So install sudo apt-get install php-gettext
Then restart sudo service apache2 restart.