Empulse Group a collection of notes from a sys admin, musician, and father


Tricks with iptables

Use iptables to force mail out a specific ip address:

[root@www ~]# iptables -t nat -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source

Rate limit port 80, 100 connection limit:

[root@www ~]# iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j DROP

PECL install package

If you are getting errors when trying to install a package using PECL, it may because of permissions on /tmp.

[root@www ~]# mount -o remount,exec,suid /tmp

Do a channel-update for both PEAR and PECL before install the package:

[root@www ~]# pear channel-update pear.php.net
[root@www ~]# pecl channel-update pecl.php.net
[root@www ~]# pecl install package

Add the line extension=package.so to the php.ini file.

Restart Apache.

Then don't forget to remount when you are done:

[root@www ~]# mount -o remount /tmp

Click here to read the cheap auto insurance quotes review.


Apache Redirect or Rewrite

You can quickly create a .htaccess file to have a domain forward to a different one.

´╗┐Redirect 301 / http://www.theotherdomain.com


RewriteEngine on
rewritecond %{http_host} ^mystuff.com [nc]
rewriterule ^(.*)$ http://www.theotherdomain.com/$1 [r=301,nc]

You can then use curl to see if the headers were updated.

[root@www ~]# curl -I www.mystuff.com
HTTP/1.1 301 Moved Permanently
Date: Mon, 08 Nov 2010 23:07:56 GMT
Server: Apache/2.2.3 (Red Hat)
Location: http://www.theotherdomain.com
Cache-Control: max-age=31536000
Expires: Tue, 08 Nov 2011 23:07:56 GMT
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1
Tagged as: , No Comments
Copyright © 2018 Empulse Group · Powered by WordPress
Lightword Theme by Andrei Luca Go to top ↑