httpd service uses a lot of memory

I noticed several times how my VPS stop working. From the logs var/log/messages/messages.log I found that the httpd service uses a lot of memory:

[30784]    48 30784    78618      471   0       0             0 httpd
[30792]    48 30792    78488      149   0       0             0 httpd
[30794]    48 30794    78488      149   0       0             0 httpd
Out of memory: Kill process 29927 (httpd) score 6 or sacrifice child
Killed process 29927, UID 48, (httpd) total-vm:339224kB, anon-rss:1848kB, file-rss:72kB
imklog 5.8.10, log source = /proc/kmsg started.
[origin software="rsyslogd" swVersion="5.8.10" x-pid="1120" x-info="http://www.rsyslog.com"] start
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-504.8.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Jan 28 21:11:36 UTC 2015
Command line: ro root=/dev/mapper/vg0-root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg0/swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_DM  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg0/root elevator=noop 
KERNEL supported cpus:

Is it possible to configure httpd to close automatically the old process httpd? Can you please suggest me a solution?

httpd service uses a lot of memory

I noticed several times how my VPS stop working. From the logs var/log/messages/messages.log I found that the httpd service uses a lot of memory:

[30784]    48 30784    78618      471   0       0             0 httpd
[30792]    48 30792    78488      149   0       0             0 httpd
[30794]    48 30794    78488      149   0       0             0 httpd
Out of memory: Kill process 29927 (httpd) score 6 or sacrifice child
Killed process 29927, UID 48, (httpd) total-vm:339224kB, anon-rss:1848kB, file-rss:72kB
imklog 5.8.10, log source = /proc/kmsg started.
[origin software="rsyslogd" swVersion="5.8.10" x-pid="1120" x-info="http://www.rsyslog.com"] start
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Linux version 2.6.32-504.8.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Jan 28 21:11:36 UTC 2015
Command line: ro root=/dev/mapper/vg0-root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg0/swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_DM  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg0/root elevator=noop 
KERNEL supported cpus:

Is it possible to configure httpd to close automatically the old process httpd? Can you please suggest me a solution?

Apache Domain Rewrite

I have users hitting my website from a different domain. My website contains hardcoded links, that cannot be come relative due to the type of platform it is on. What I want to be able to do is something in my httpd.conf that substitute's the domain in my url for the domain the users are hitting for the new domain. For example :

<IfModule "%{HTTP_HOST} == 'external domain'">
 Substitute "s|old domain|external domain|in"
</IfModule>

Is something like this achievable in the httpd.conf? Any help is appreciated!

htaccess rewrite rule with wildcards

I am trying to create a htaccess file for my site.

I would like it so that when a user enters http://sitename.co.uk/category/productname/?pid=productID they are shown the page http://sitename.co.uk/product.php?id=productID

So the category and the productname are essentially wildcards and can be anything as the page is powered by the productID.

I have tried writing the following but have had no luck with it...

RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/(?pid=.*)$ product.php?id=$1 [L,NC]

Will .htaccess work with an ip only?

I am testing a website on an ip. I don't have the domain name linked yet. I wanted to test the .htaccess and have it only show the name of the php file and not the full string. I am not displaying my real ip here.

Example I want this:

http://111.111.111.111/~myWebsite/?id=My-Linked-php-file.php

to display this:

http://111.111.111.111/~myWebsite/My-Linked-php-file

So when it's live it will look like:

http://www.mywebsite.com/My-Linked-php-file

But it's not working, so I am wondering if I need to use the domain name and not the ip. Is there a way around this?

Here is my .htaccess file:

RewriteRule ^([\w\-]+)/*$ ?id=$1 [L] # Should display only file name not /?id=
RewriteRule ^([\w\-]+)/([\w\-]+)/*$ ?id=$1&p=$2 [L] # Second var shows up as a folder.

How to redirect a complete request URL with escaped query string?

I have a URL: http://example.org/abc?a=1&b=2 (the query string is variable).

I want to redirect it to the following URL using mod_rewite: http://example.org/test.php?url=abc%3Fa%3D1%26b%3D2 (the query string is escaped).

I don't want the URL to become: http://example.org/test.php?url=abc&a=1&b=2,

which is what I get when I use: RewriteRule ^(abc) test.php?url=$1 [QSA].

I also tried:

RewriteCond %{THE_REQUEST} ^[A-Z]+\ ([^\s]+)
RewriteRule ^(abc) test.php?url=%1

but to no avail. Any suggestions?

Ubuntu TCP SYN response

I'm crafting my own packets via libpcap. I'm running two virtual machines and I'm trying to flood machine running apache server. When I send a single packet, everything works fine, server responses with SYN/ACK. When I put this into a loop (I'm spoofing source address, changing id numbers and so on...), server responses to the first packet and then starts ignoring incoming packets and can still connect to apache server from different machine. Tried to disable syncookies and so on but no luck. Tried to flood machine with Ubuntu 14.04 and another machine with Windows xp.. same result. Any ideas? Thanks in advance.

Ubuntu TCP SYN response

I'm crafting my own packets via libpcap. I'm running two virtual machines and I'm trying to flood machine running apache server. When I send a single packet, everything works fine, server responses with SYN/ACK. When I put this into a loop (I'm spoofing source address, changing id numbers and so on...), server responses to the first packet and then starts ignoring incoming packets and can still connect to apache server from different machine. Tried to disable syncookies and so on but no luck. Tried to flood machine with Ubuntu 14.04 and another machine with Windows xp.. same result. Any ideas? Thanks in advance.