Crontab - Restart apache every 3 hours [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
My server is currently suffering from some problems due to visitors lag and i think the best solution for it, is to restart apache every 2/3 hours or so
How can i do this through cronjob ?

Why do you want to do this?If you are experiencing a specific problem with Apache.It Will definitely be more beneficial for you to have a look into the access/error logs, and make adjustments accordingly.Give us some more information and we can look into your logs and give you a more appropriate solution.
None the less heres the cron to restart apache.
0 */3 * * */ root/restart_apache > /dev/null 2>&1
/etc/init.d/httpd restart

I can almost guarantee this 'fix' will not address your real issue. Why not post your Http.conf settings and a little info on your server resources (memory, cpus) and we might help fix your config issues.

Instead of adding to the crontab of an individual user (root), I would add hacks like this to /etc/cron.d.
Change 'apache2' to whatever the init script is on debian.
echo '* */3 * * * root /etc/init.d/apache2 restart 2>&1 >/dev/null' > /etc/cron.d/apachesux

Related

SSHing in to EC2 Ubuntu instance with user ubuntu tells me to login as ubuntu [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm having an issue where I try to SSH into my API server (EC2 instance running Ubuntu). I've been SSH'ing in just fine for the past few weeks, but I suspect I messed something up because now it tells me to login as user ubuntu (I am!) :
% ssh ubuntu#ec2-50-17-143-255.compute-1.amazonaws.com -i ~/dev/key.pem
Please login as the user "ubuntu" rather than the user "root".
Is there something I could have done to mess with the ubuntu user? Is there anyway to resolve this without having to save the AMI and boot up a new instance?
Please use ssh -v ... or ssh -vv ... to see what is going on.
In your case it looks like you copied ~root/.ssh/authorized_keys to ~ubuntu/.ssh/.
According to this, the root account is configured to reject logins with this message using the authorized_keys file. If you copied this file, now the user ubuntu will reject logins with this key, too...

How to install/configure mod_reqtimeout in Apache [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I need to configure mod_reqtimeout in my Apache server v2.2.22 (in a linux machine). Problem is, I have absolutely no clue on how to do it.
I checked the Apache site on this module at this link but there was no download/configuration details given.
Can someone help me on this ? Any help is much appreciated. Basically,
Is there something needed to download ?
If not, which files do I need to edit and how?
It's a standard Apache module from 2.2.15 and later, but is apparently missing in some distro versions (e.g. Ubuntu, FreeBSD).
First, check that mod_reqtimeout exists (e.g. look in apache2/modules/ or - depending on your system - do something like /usr/sbin/httpd -l | grep mod_reqtimeout). Second, if it is, make sure it's enabled in your Apache config.
mod_reqtimeout is available from GitHub (also see the RPM resource). Finally, this thread has some useful tips. BTW FYI I don't think it can be enabled in an .htaccess file.

Tomcat Multiple Localhost Instances [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
What is the smartest way to configure Tomcat to have two localhost instances?
Please note that I do not have admin rights to the system, and so don't have access to the /etc/hosts file. I would love to be able to do something like the following, but can't modify my /etc/hosts files:
http://juststuffreally.blogspot.com/2007/03/enabling-multiple-localhost-sites-in.html
I'd like to have something like this, so that my instances of localhost would look as follows:
keith.localhost.com
joe.localhost.com
...but I can't modify my /etc/hosts file =-(
Another resource that I found was this, but this gives instruction for multiple outside domains--I need multiple localhost instances:
http://iam-rakesh.blogspot.com/2009/10/hosting-multiple-domains-in-tomcat.html
Any ideas?
Thank you for your help.
You can run multiple instances of tomcat on multiple ports. You would need a unique server.xml for each instance, and each one would need different ports defined in the appropriate <Server> and <Connector> elements.
Once everything is set up, you would specify an explicit port when connecting to the instance, e.g.:
- http://localhost:8080/
- http://localhost:8081/
This document covers the process in a little more detail.

wordpress permalinks 404 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i've read wordpress and the post on here for fixing this and i'm stuck.
i just setup a stock apache2 server with wordpress. my default link for posts works however other options don't.
i've deleted .htaccess and let wordpress regen an not working. by the way i even chmod 666 777 660 nothing works.
The only thing in my .htaccess is two lines begin and end wordpress. i added override above all and still nothing.
I looked in apached2.conf but see no modules for loading overrides.
is this a server issue or wordpress permission or something. if I can narrow it to one side or the other.
also http.conf is empty if that helps.
I got it. had to chown www-data my /var/www
Did you enable mod_rewrite in http.conf?
Earlier SO question: How to enable mod_rewrite for Apache 2.2

How can I keep Apache stopped on Ubuntu? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Actually, I want something like WAMP (for Windows). The Apache service should be always stopped. Whenever I need it to be running, I go to the Start Menu and turn it on. Is there a way to make it possible on Ubuntu?
Remove apache "autostart" from runlevels with the following:
sudo update-rc.d apache2 remove
Make a script with the following:
#!/bin/bash
gksudo /etc/init.d/apache2 start
Make it runnable
chmod 0755 apache-starter-shell-script-name
And run it when you want to start apache.
I think this is more a serverfault.com question.
Nevertheless you could modify your runlevel configuration (Ubuntu uses upstart instead of init) and then start apache manually from the console when you need it.
Unfortunately I don't know the upstart configuration options by mind but I think some googling for it's configuration should help you.
Edit: Maybe Boot-Up Manager is what you need (http://www.marzocca.net/linux/bum.html) - I don't use Ubuntu as desktop.
Edit2: Try
sudo update-rc.d apache2 disable