Category Archives: Web Server Hacks

Web Server Hacks

Recommended Web Server Hacks

How to Allow MySQL Access to Certain IP/Servers!

For those of you who run separate MySQL servers, you can easily block unwanted visitors and give access to your other web servers simply replacing “localhost” with your subnet such as “192.168.1.%”, where the % will be a wild card to allow any servers in the 192.168.1.xxx to connect.

This can easily be changed via phpMyAdmin.

Leave a comment

How to Generate SSH Keys!

To generate SSH keys, just do:

ssh-keygen -t dsa

Then do:

cat /root/.ssh/id_dsa.pub

Then copy over the whole thing into /root/.ssh/authorized_keys on the server you are trying to get connection.

 

This can be useful for setting up RSync between two servers.

Leave a comment

How to Restart Networking on Linux!

Here’s how to restart networking services on your linux webserver.  I find that especially with VPS web servers, there are times where your network gets blocked completely.

To reset, get into SSH via console on your VPS web server company’s control panel.

Type:

service network stop

then

service network start

For some web servers, you might have to use:

/sbin/service network stop

and

/sbin/service network start

Wait like 5 seconds and see if you can ping the outside world:

ping google.com

If you

Click Here to Read Full Article

Leave a comment

How to Install PHP-FPM for Nginx!

Recently, I’ve switched some of my web servers that handle large file downloads from spawn-cgi to PHP-FPM.  The result is that I can handle more large files with more PHP-CGI processes while my site still loads well even if there’s many concurrent downloads going on.

I am still experimenting with PHP-FPM but it seems like a pretty good way to go as far as handling the PHP-CGI processes.

To do this, you will need to install EPEL & CentALT repositories:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

rpm -Uv

Click Here to Read Full Article

Leave a comment

How to Optimize Large File Downloads on Nginx!

For those of you who have large file downloads on your web server, your web server might have trouble loading the faster parts of your website while users hog your bandwidth.

I’ve been researching many ways to optimize large file downloads but probably the best way is to simply rate limit the bandwidth on how fast each user can download.

You can add the following line to your HTTP directive in /etc/nginx/nginx.conf:

limit_rate 100k

This will limit each user to download at maximum of 100kb/second.

You can change this number to see which one fits best

Click Here to Read Full Article

Leave a comment

Really Great Article on MySQL and Web Server!

Check out this great article by a MySQL expert who goes into detail how MySQL and web servers work and take on the load on servers. – link

Click Here to Read Full Article

Leave a comment

Simple Firewall for CentOS Linux!

For those of you who are getting DoS attacks and whatnot on your CentOS server, you might want to first make sure you have only WWW (port 80) and SSH (port 22) open.

You can do this with iptables (which is pain is the a**) or just use this: yum install system-config-securitylevel Then do: /usr/bin/system-config-securitylevel-tui

And there’s a “Customize” menu where you can set WWW and SSH open.

Click Here to Read Full Article

Leave a comment

How to Fix One PHP-CGI Running!

The other day I had a problem with one of my newest servers, upon which I had installed new version of Nginx and Spawn-fcgi.

Well, my Nginx kept crashing, actually my PHP-cgi processes started crashing after the server ran for a bit. The weird thing was, the server had no load.

Upon carefully watching my “top” status in linux for awhile, I realized there’s only one PHP-CGI process running, whereas all my other Nginx web servers ran multiple (around 5-6 at any given time).

I compared out the versions of the Spawn-cgi and realized the new Spawn-cgi I ha

Click Here to Read Full Article

69 Comments

How to Reset WordPress Password via MySQL Command Line!

For those of you wondering how to reset your WordPress admin password via MySQL command line, here’s how to do it:

Enter your MySQL command line with something like:

mysql -uroot -p

Then enter your password.

Once inside the MySQL command line do:

show databases;

and then find your database for the WordPress blog that you want to change password.

use mydatabase;

where mydatabase should be “your” database.

Then do:

update wp_users set user_pass =MD5(’typenewpasswordhere’) where id=1;

Click Here to Read Full Article

Leave a comment

How to Add DNS Caching to Your Web Server!

If you have a website that uses a lot of API requests (such as dealing with Twitter), you can save a lot of server load/costs simply by installing DNS caching to your web server.

Each DNS request (every time you request from any domain name using an API) takes anywhere between 0 to 500 miliseconds. Sometimes, adding DNS caching to your web server can make your website load in 1 second versus 10 seconds.

Anyways, it’s easy to do and here’s how to do it on CentOS/Fedora linux servers: (Ubuntu should be similar, just use apt-get install of yum)

First install

Click Here to Read Full Article

Leave a comment
  • Page 1 of 2
  • 1
  • 2
  • >