You can send emails of your server from an additional IP of your server instead of the main IP using iptables. Here is the iptable command:
iptables -t nat -A POSTROUTING -o eth0 -p tcp -j SNAT –dport 25 –to-source IPAddress
where, “IPAddress” is the additional IP of your server. To save the rule, execute
service iptables save
This will make the settings permanent and you can check the rule using
iptables -L -t nat
Wednesday, January 27, 2010
Turn on allow_url_fopen
In order to turn ON allow_url_fopen for a single account on a phpsuexec server, edit the file
vi /usr/local/apache/conf/httpd.conf
scroll down to the VirtualHost entry of the domain and insert the following lines
php_admin_value allow_url_fopen On
php_admin_value allow_url_include On
Save the file and restart the Apache service.
vi /usr/local/apache/conf/httpd.conf
scroll down to the VirtualHost entry of the domain and insert the following lines
php_admin_value allow_url_fopen On
php_admin_value allow_url_include On
Save the file and restart the Apache service.
Delete Frozen Emails
Howto check number of emails in the mail queue:
exim -bpc
To check the email ID, sender and receiver of the each email:
exim -bp | more
To delete frozen emails from the mail queue, execute:
exim -bp | grep ‘frozen’ | awk ‘{print $3}’ | xargs exim -Mrm
similarly, to delete emails sent using a script’
exim -bp | grep ‘<>’ | awk ‘{print $3}’ | xargs exim -Mrm
exim -bpc
To check the email ID, sender and receiver of the each email:
exim -bp | more
To delete frozen emails from the mail queue, execute:
exim -bp | grep ‘frozen’ | awk ‘{print $3}’ | xargs exim -Mrm
similarly, to delete emails sent using a script’
exim -bp | grep ‘<>’ | awk ‘{print $3}’ | xargs exim -Mrm
error: ‘PIX_FMT_RGBA32′ undeclared
The below error is common while installing FFMPEG-PHP on the server and where people run out of ideas
/root/ffmpeg-php-0.5.0/ffmpeg_frame.c:495: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1
The error occurs because of incorrect function declared in ffmpeg_frame.c file which can be resolved by either of the methods mentioned below:
1) Edit the file ffmpeg_frame.c and replace all the instanaces of “PIX_FMT_RGBA32″ with “PIX_FMT_RGB32″ and save the file
OR
2) Execute the replace command:
replace “PIX_FMT_RGBA32″ “PIX_FMT_RGB32″ — ffmpeg_frame.c
Once done, recompile ffmpeg-php once again.
/root/ffmpeg-php-0.5.0/ffmpeg_frame.c:495: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1
The error occurs because of incorrect function declared in ffmpeg_frame.c file which can be resolved by either of the methods mentioned below:
1) Edit the file ffmpeg_frame.c and replace all the instanaces of “PIX_FMT_RGBA32″ with “PIX_FMT_RGB32″ and save the file
OR
2) Execute the replace command:
replace “PIX_FMT_RGBA32″ “PIX_FMT_RGB32″ — ffmpeg_frame.c
Once done, recompile ffmpeg-php once again.
Got a packet bigger than ‘max_allowed_packet’ bytes
“Got a packet bigger than ‘max_allowed_packet’ bytes”
The message is displayed when you try to restore a database and the packet size if more than the default one OR the one defined in the my.cnf file.You can check the existing bytes with the following command
root@server [~]# mysqladmin variables | grep max_allowed_packet
| max_allowed_packet | 1048576 |
To overcome the issue, add the following parameter in the my.cnf file
max_allowed_packet = 2097152
The value should be more than the default one. Save the file and restart the mysql service.
The message is displayed when you try to restore a database and the packet size if more than the default one OR the one defined in the my.cnf file.You can check the existing bytes with the following command
root@server [~]# mysqladmin variables | grep max_allowed_packet
| max_allowed_packet | 1048576 |
To overcome the issue, add the following parameter in the my.cnf file
max_allowed_packet = 2097152
The value should be more than the default one. Save the file and restart the mysql service.
Howto: Check Apache Connections
How to check number of connections to the Apache server?
netstat command will show you the accurate connections to each of your service. In order to check the number of connections to port 80, use the netstat command and grep the Apache port.
List the connections to port 80:
netstat -alntp | grep :80
To check the number of connections to port 80:
netstat -alntp | grep :80 | wc -l
List the remote IPs connecting to your server on port 80:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort
List the uniq remote IPs and the number of connections from each IP:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
Please note: If you copy paste the above commands on your server, the single quote around the {} brackets may change to dots (.) and the command will fail, so make sure you replace those dots with the singe quote and execute the command.
netstat command will show you the accurate connections to each of your service. In order to check the number of connections to port 80, use the netstat command and grep the Apache port.
List the connections to port 80:
netstat -alntp | grep :80
To check the number of connections to port 80:
netstat -alntp | grep :80 | wc -l
List the remote IPs connecting to your server on port 80:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort
List the uniq remote IPs and the number of connections from each IP:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
Please note: If you copy paste the above commands on your server, the single quote around the {} brackets may change to dots (.) and the command will fail, so make sure you replace those dots with the singe quote and execute the command.
Howto: enable HTTP Compression
How to enable HTTP Compression? In order to enable compression, you will need compression modules compiled with Apache. Apache 1.x needs mod_gzip and Apache 2.x need mod_deflate compiled with it.
If you have these module installed, you need to edit your Apache configuration file locate at “/etc/httpd/conf/httpd.conf” file and add the following lines to it:
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
Save the file and restart the httpd service. This will compress all the files except the .gif, .jpe, .jpeg and .png files.
If you have these module installed, you need to edit your Apache configuration file locate at “/etc/httpd/conf/httpd.conf” file and add the following lines to it:
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
Save the file and restart the httpd service. This will compress all the files except the .gif, .jpe, .jpeg and .png files.
Subscribe to:
Posts (Atom)