Nginx Canonical Domain

Valic —  July 19, 2011 — Leave a comment
############# www to non-www
server{
  listen 80;
  server_name  www.debian-tutorials.com;
  rewrite ^(.*) http://debian-tutorials.com$1 permanent;
}

############# non-www to www
server {
  if ($host ~* ^([a-z0-9\-]+\.(com|net|org))$) {
    set $host_with_www www.$1;
    rewrite ^(.*)$ http://$host_with_www$1 permanent;
  }
}

Enjoy

The following tutorial is done with Debian Squeeze version 6.0.2.
In this tutorial, I will show you the shortest and easiest way to set up nginx  with PHP5, MySQL and phpmyadmin running through FastCGI:

Step 1: Installation:

apt-get install nginx mysql-server mysql-client php5 php5-cgi php5-mysql phpmyadmin

NOTE: After you have installed all above you will need to edit the php.ini file:
Open php.ini file end remove the ; in front of the line cgi.fix_pathinfo=1

Step 2: Make PHP FastCGI daemon listening on port 9000 on localhost and start at boot.

Edit the /etc/rc.local file and put the following content:

vim /etc/rc.local
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

Step 3: Create virtual host file for your site:

Continue Reading…

If you discovered that proxying your webserver with varnish breaks PhpMyAdmin I’ve got the solution:

Problem is that the backend webserver, apache2 or nginx doesn’t even know it’s running behind another software.

Varnish does a completely normal request to webserver. Most times this isn’t any problem at all.

PhpMyAdmin tries to be “smart” and figure out its absolute URL and I run the apache2 or nginx backend on port 80.

The solution is to force an URL.

Add the following line to “config.inc.php“, changing the obvious:

$cfg['PmaAbsoluteUri'] = 'http://yourdomain.com/phpmyadmin/';

Enjoy!

If you run a firewall on your Debian  server and want to use passive FTP connections, you have to define the passive port range in pure-ftpd and your firewall to ensure that the connections dont get blocked.

The following example is for pure-ftpd on Debian Squeeze:

Configure pure-ftpd:

echo "50000 50120" > /etc/pure-ftpd/conf/PassivePortRange

/etc/init.d/pure-ftpd restart
Restarting ftp server: Running: /usr/sbin/pure-ftpd -l pam -l 
puredb:/etc/pure-ftpd/pureftpd.pdb -p 50000:50120 -O
clf:/var/log/pure-ftpd/transfer.log -S 192.168.1.100,2121 -8 UTF-8 -H -u 1000 -E -B

Enjoy

Create a Virtual Server:
Once you have OpenVZ installed you will be able to begin the process of installing individual containers.

Using the vzctl command you will be able to create a virtual server.

vzctl create 102 –ostemplate debian-6.0-x86 –config basic
Creating container private area (debian-6.0-x86)
Performing postcreate actions
Container private area was created

The following setting provides for the VE to start on boot:

vzctl set 102 –onboot yes –save

vzctl set 102 –hostname  debian-tutorials –save
Continue Reading…

Page 24 of 44« First...10...20212223242526272829...40...Last »