Amazon Lightsail: Bitnami LAMP server website hosting: sudo service apache2 restart - apache

I am trying follow the guide here:
http://www.servermom.org/how-to-add-new-site-into-your-apache-based-ubuntu-server/
to host a few PHP files on the web. Everything works until the second to last step: the command in the title. The console message I get is below:
bitnami#ip-*not important*:~$ sudo service apache2 restart
* Restarting web server apache2
AH00112: Warning: DocumentRoot [/var/www/html] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified do
main name, using 127.0.0.1. Set the 'ServerName' directive globally to suppres
s this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]
:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.
0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
[fail]
* The apache2 instance did not start within 20 seconds. Please read the log f
iles to discover problems
I open the access.log and error.log files in /var/log/apache2 with nano and both appear empty. Any ideas on why "Action 'start' failed"?
Thanks in advance for any help

Bitnami puts the systems under it's control into a non-standard location. They can be found under /opt/bitnami. I'd recommend checking out their Documenation on the configuration of Apache.
Common differences:
Configuration is stored in /opt/bitnami/apps/myapp/conf/
Base folders like /var/www are application specific like /opt/bitnami/apps/<app_name>/htdocs/, where is the name of your app.
Restarting Apache can be done with sudo /opt/bitnami/ctlscript.sh restart apache
Access and Error logs can be found at /opt/bitnami/apache2/logs/access_log and /opt/bitnami/apache2/logs/error_log respectively
Hope that helps get you in the right direction.

Related

Apache couldn't be started. Setting up Virtual Hosts. MAMP

I'm trying to setup Virtual Hosts on my mac using MAMP but I was not able to run my apache.
I already did this before by following this tutorial but still my attempts are unsuccessful.
I'm running OSX Yosemite and MAMP 4.5
Update 1:
I tried running sudo /Applications/MAMP/Library/bin/apachectl start
and it returns this
(48)Address already in use: make_sock: could not bind to address [::]:80
(48)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Update 2:
I tried renaming envvars_ and restarted the apache sudo apachectl restart still the apache is not running
Solved
Upon troubleshooting, what I did is force quit all the httpd processes on my activity monitor and restarted the mamp!!
Another server is already using port 80. You need to change the port of one of them. A port, like 80, can be used once per IP address.
Peter

Apache wont restart after I enable SSL

Once I a2enmod the ssl module and restart apache I get the following error:
Restarting web server apache2
AH00548: NameVirtualHost has no effect and will be removed in the next
release /etc/apache2/ports.conf:14
(98)Address already in use: AH00072: make_sock: could not bind to address
[::]:443
(98)Address already in use: AH00072: make_sock: could not bind to address
0.0.0.0:443
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
To stop it I can either disenmod or comment out the following module lines in the ports.conf file:
Listen 80
#<IfModule mod_ssl.c>
# Listen 443
#</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Any help would be much appreciated
The following lines of your output state that an other programme is already listening on port 443 and due to the fact that Apache does not support port sharing it is unable to bind to that port and so it shuts down.
(98)Address already in use: AH00072: make_sock: could not bind to address
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
Thus I recommend you to shut the programme listening to that port down. You can determine which programmes are listening on TCP port 443 with the following command (must be executed as super user):
netstat -tlpn | grep 443
Then shut down the already listening programme (for example by using service <programme> stop or by using kill <processID> (the process ID is also supplied by netstat). Afterwards, you can start Apache by using service apache2 start or by executing /etc/init.d/apache2 start. Both commands work when you are working with Ubuntu/Debian. If you are working with CentOS/RedHat Apache is named httpd.
The error "AH00015: Unable to open logs" is indicative of a missing file or directory in one of your log definitions. If you have a web server with a lot of virtual named sites running on it, it is easy to delete an old directory and forget to update the httpd-vhosts.conf or httpd-ssl.conf files to remove the config.
I run FreeBSD 10.3 with Apache 2.4, so my files may be in another location that yours. But once you find where your virtual hosts files are located, the solution is the same. This is what you need to do to solve this:
Change into the directory where your virtual named hosts are defined:
cd /usr/local/www/conf/extra
Use grep to pull all of the log file references out of your named
virtual host definitions:
grep -i log * > x.tmp
This will create a file with entries that show the name of the file, the apache log directive (ErrorLog, CustomeLog, TransferLog), and the name of the log file.
Use the bash shell to setup a while read loop to pull the file apart
and capture the names of the log files in another file:
cat x.tmp | while read a b c d; do echo $c >> y.tmp; done
Use your favorite editor to edit the y.tmp file to remove anything
that does not look like the name of a log file (junk). This junk is
inevitable with using grep to search for text in a big file. Once
you have a list of files (and nothing else), insert "ls -la " in
front of the file names. With the vi editor you can do this with
the following command:
:%s/^/ls -la /
Run the file as a script using sh or bash as follows:
sh y.tmp
It will show the individual file if it exists, and if it does not
exists it will display an error similar to the following:
ls: /usr/local/www/virtual/nsr/logs/access.log: No such file or directory
This could be caused by a misspelling, a missing directory, or some
other cause (a symlink that points to a non existent object). Either
edit your virtual named hosts definitions to remove it from the
configuration, or define the directory with the correct permissions
for the web server to access it.
Restart the web server (apachectl start) and verify the httpd
daemons are running using ps awx | grep http.
Based directly on this answer, you should kill httpd (it has server.port = 80 in its lighttpd.conf) and then try to start apache.
= Show processes hung =
ps wax | grep httpd
= Kill Process ID 1234 =
kill 1234
= Start Apache24 =
apachectl start
= Verify it is running =
service apache24 status

Apache Starting Error and all log files are empty

When i try to start my apache2 in ubuntu, it displays following error.
* Starting web server apache2
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:8
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address 127.0.0.1:8080
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
*
* The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
And My log files in var/log/apache2/ files error.log,acces.log files not updated after i emptied it.
Please help me to solve it.
Probably some other service is already using port 8080. Run
# netstat -lnpt
to see what it is.

Starting web server apache2 failed

I have a Virtual Server. Till yesterday everything works fine on it.
Today my Hostcompany restarted my server to config something on I/O.
When I trying to get to my address I get
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
I tried to sudo service apache2 start and get these Error Message:
* Starting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
*
* The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Does someone know how I can fix this problem?
Stop Nginx service nginx stop
Restart Apache service apache2 restart
You have another webserver that's running on the host (probably as part of the startup during the restart) You need to shut that off first.
You can run netstat -tulpn | grep :80 and that'll tell you what that process is
The problem is this, Nginx (another web server engine) it's using your port 80 so apache it's unable to start, a fast fix it turn of nginx and then restart apache.
You can do it with service nginx stop and service apache2 restart if you are using Ubuntu or Debian based release, if you are using an RHEL distro then use service nginx stop and service httpd restart
Here is my solution
first: sudo update-rc.d -f nginx remove
than: sudo rm /etc/init.d/nginx
after restarting VM almost everything works fine. Some strange thing is almost there.
When I goto www.myfoobarwebpage.com now apache is working and it's all ok!
When I goto myfoobarwebpage.com (without www.) I get "Welcome to nginx! ..."
Try this. My Apache config has 2 extra lines by mistake.
"Include conf/extra/httpd-8080.conf"
"Include conf/extra/httpd-8080.conf"
Therefore, it was saying address already in use because it already loaded the Virtual host once and was trying again.
Solution was to delete this extra line and have only one include.

Apache SSL server not starting, "Address already in use"?

I have installed Apache 2.0.58 together with PHP 5.1.4. When I start the server using ./apachectl start, I manage to get the server running to serve HTTP as well as PHP pages, but when I try to start SSL for HTTPS using ./apachectl startssl, I get the error below:
(125)Address already in use: make_sock: could not bind to address [::]:54912
no listening sockets available, shutting down
Unable to open logs
When I run netstat -an | grep 54912 I don't see that port 54912 is being used at all. For reference, I hosted my HTTPS page on port 54912, and while in "httpd.conf" it already has the Listen 54912 directive, I also changed the file "ssl.conf" to Listen 54912 from the default Listen 443for https.
Any idea how I can get my server to run and serve HTTPS?
It's probably because apachectl startssl was deprecated in version 2.0 (and was removed in has version 2.2)
It's likely that apache start has already started the SSL virtual hosts, in particular if these virtual hosts (or other SSL-related options) haven't been defined in a <IfDefine SSL> section (because in Apache 2.0, apachectl startssl is equivalent to apachectl -k start -DSSL): they would be part of the main configuration.
Got the server running! :)
As mentioned by #EJP, the problem is because there are 2 Listen 54912 inside config. So by changing the file httpd.conf to Listen 14912 and retaining the file ssl.conf to Listen 54912, I can now run apachectl startssl and after entering the password, the server is up and running!
Special thanks to Tim Yencken for the help. (Dunno if he's here or not).