How to stop tomcat and start apache2? - apache

I have this server, that i have not installed personally. There are Apache2 and Tomcat6 running together. I want to stop Tomcat6 and use Apache2 but when i do
sudo service tomcat6 stop
sudo service apache2 restart
if i type 'localhost' in my browser i get a '503 service unavailable' error. So how i can get Apache2 'take control'? I mean i want the default site of Apache2 to be displayed on 'localhost' instead of tomcat'one.
(If i type locahost with Tomcat running i get an "it works" welcome page.)

Apache2 will have control when Tomcat is stopped and you start Apache. With Tomcat running on same port, you are unable to start Apache. Solution to 503 error is in Apache logs.

Related

Apache not starting alongside Nginx

Have a development server with 2 static ips. Apache runs on one, Nginx on the other. Everything seems fine except after reboot. Nginx starts Apache doesn't. Can someone please tell me where to look outside log files for what the issue could be...or tell me the process on how to make this work..
Thanks in advance...
12/19/2018
Rebuilt the server using only Apache. When binding it to a single ip to one interface it still does not start after boot. When I unbind it, it boots fine. Doesn't seem to be a conflict with Nginx on the other ip, seems to do with the binding of Apache itself...still perplexed...
I went to sudo nano /etc/apache2/ports.conf
Changed Listen 80 to Listen 8080 and I was able to restart apache2 after that with the following command:
sudo systemctl restart apache2
It's probably because default port for both nginx and apache is 80. So for example when nginx starts, the port will be in use, and apache can't access to that port.
in ypur httpd.conf of apache, find the line that says Listen 80 and change that port to whatever you want. then restart apache.
If this is not the issue, then report results of these commands in your post plz:
$ systemctl status httpd // or apache2 instead of httpd
$ systemctl status nginx
$ jourcanctl -xe

Why I can't reload apache2 on Ubuntu?

On Ubuntu, each time I use sudo service apache2 reload command to reload apache2 service , my terminal showed
apache2.service is not active, cannot reload.
And, I'm trying to add phpMyAdmin as virtual host, using phpmyadmin.local as local-area-network domain name; can anyone tell me how? I have tried many times today, I searched many methods, but until now, it's still 404 not found.
I had the same problem with Ubuntu 16.04. This was causing problems with logrotate, because it could not reload Apache after rotating logs.
The full error I was getting:
/etc/init.d/apache2 reload
[....] Reloading apache2 configuration (via systemctl): apache2.serviceapache2.service is not active, cannot reload.
failed!
The problem went away after stopping Apache with apachectl and starting it with /etc/init.d/apache2:
apachectl stop
/etc/init.d/apache2 start
You can now reload Apache:
/etc/init.d/apache2 reload
[ ok ] Reloading apache2 configuration (via systemctl): apache2.service.
If you start Apache with apachectl start, it is not being marked as an active service, so you can't reload it with service apache2 reload. You have to start Apache with /etc/init.d/apache2 start or service apache2 start.
I'm not sure if it's intended or a bug. I can't reproduce this with an older system.
Actually you should check if another service/server is running in the port 80 :
sudo netstat -tulpn | grep :80
If it's not apache2, stop it (for me it was lighttpd so sudo service lighttpd stop.
Then start apache2 (sudo service apache2 start) and enjoy!
check if you are missing /usr/sbin/apache2
Then if you are run: sudo apt install --reinstall apache2-bin

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.

How can I configure Virtual Host without restarting Apache web server?

I created a new virtual host in apache web server and I dont want to restart Apache
Does Anybody know How can I configure VirtualHost without restarting Apache web server?
Also Is it possible to do it on windows server?
this is not possible .... you have to restart the server to get new / changed vhost.
what you can do is: restart the server without kill any active connections by:
/etc/init.d/apache2 -graceful [*]
[*] /etc/init.d/apache2 is your executable file
You can reload apache2 for get affect newly changes.
$ sudo systemctl reload apache2

Passenger with apache and nginx on the same development box

I've got Apache and passenger on my notebook. I want to test Nginx and passenger on the same machine. I can install Nginx on 8080 and apache on 80. But can I install passenger with both the same server on the same machine?
Yes, simply install the apache module and then the nginx module. You'll probably need to make sure each server has a different PassengerTempDir setting too.
I had both Apache and Nginx with passenger installed and working fine on the same Arch Linux machine, serving a Rails app. Once, with apache running and listening on port 80, I started nginx listening on the same port and got an (expected) error about the port being already bound. I stopped apache and nginx, restarted nginx and started getting Bad Gateway errors whenever I tried to access the Rails app under Nginx. I still haven't figured out what the problems is and how to fix it. Rebooting doesn't seem to help.