Few days ago I had to deal with this error when I wanted to restart my Nginx Web Server:

/etc/init.d/nginx restart
Stopping nginx:                                            [FAILED]
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]

After some internet searches, I’ve found the fix:

fuser -  Is displaying the PIDs of processes that are using the specified files or file systems.

Then you need to search what PID (process ID) is using the 80 port by typing the following command:

fuser -n tcp 80
80/tcp:                459   465   477

Now just kill those processes: Continue Reading…

nginx-black-logo

This is another way to run phpMyAdmin on Nginx.

1. Install phpMyAdmin on Nginx:

apt-get install phpmyadmin

When the pop up shows up, select neither Apache or Lighttpd. You don’t need any to run phpMyAdmin on Nginx.

Screen Shot 2013-03-29 at 12.34.34 AM

And say select NO for the Configure database for phpmyadmin with dbconfig-common:

Screen Shot 2013-03-29 at 12.34.20 AM

2. Configure phpMyAdmin to work with Nginx:

Add the followings to /etc/nginx/sites-available/default file after the server{ statement: Continue Reading…

If you want to monitor your Nginx server status and all connections per second just like Apache mod_status unde Debian or any Linux/Unix distribution follow this tutorial.

By default, Nginx web server comes with a module called  HttpStubStatusModule that provides information on Nginx active connections, connections per second and other.

This tutorial will show you how to enable this feature in Debian Squeeze:

1. Configure Ngins Status:

First, open the nginx.conf file. On Debian, this is located under the /etc/nginx directory.

# vi nginx.conf

Then add the followings in context location or under every virtualhost that you have configured:

location /nginx_status {
#This turn on stats
stub_status on;
access_log off;
#You can allow only from your home IP address or from any location
allow 192.168.1.100; #Let's day that this is your IP
#Uncomment the next line if you want to allow access to this from anywhere
#allow all;
deny all;
}

2. Save and close the file and reload nginx server:

/etc/init.d/nginx restart
[ ok ] Restarting nginx: nginx.

OR Continue Reading…

When you are browsing a website, you can check the type of web server running by retrieving the response server header. For example the following server response return for website http://www.debian-tutorials.com:

HTTP/1.1 200 OK
Server: Apache/2.2.22
Date: Mon, 04 Mar 2013 00:43:59 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.2.17
X-Pingback: http://www.debian-tutorials.com/xmlrpc.php
Cache-Control: max-age=7200
Expires: Mon, 04 Mar 2013 02:43:58 GMT
Vary: Accept-Encoding

From the information we can know that the web server is running on Apache version 2.2.22.

By using NginX you can personalize and customize your server header to the name that you want. Instead of showing the real web server name which is “nginx“  you can set for users to see the web server name as “my websites webserver“.

In this guide I will show you how to  customize server header using NginX headers-more module without compiling again the server.

1. Install Nginx webserver if you don’t have it installed already.

You can use this guide to do it: Setting up Nginx plus PHP FastCGI on Debian 6.0.6 Squeeze

2.Install nginx-extras package.

In Debian Squeeze exists one package called nginx-extras that contains some standard modules, plus extra features and modules like headers-more-module and others. You can find more info here: http://packages.debian.org/sid/nginx-extras

Install the nginx-extras packages like this:

apt-get install nginx-extras

3. Make some changes under  http directive to NginX configuration file which located under /etc/nginx/nginx.conf as below: Continue Reading…

This article is about setting up Nginx + PHP-FastCGI on Debian 6.0.6 Squeeze

Step1. Install nginx and php5-cgi :

apt-get install nginx php5-cgi

Step2. Replace Nginx default virtualhosts config with the following content:

server {
listen [::]:80;
server_name debian-tutorials.com;
root /var/www/debian-tutorials.com;
index index.html index.htm index.php;
access_log /var/log/debian-tutorials.com.access.log;

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

NOTE: Replace debian-tutorials.com with your own domain.

Step3. Create a  Debian init script to control the php-cgi daemon.

Continue Reading…

Page 1 of 3123