Archive for July, 2010

You can properly find vHost tutorials for Apache (HTTPD) and Lighttpd by ease on the internet.
But, how about Nginx?
There are tutorials for Virtual Hosts, but to make FastCGI to work, there’s only one site (our source).
We’ll make one tutorial more about Nginx.
This is about more Virtual Hosts at a time.

In this example, we use /var/www/domain#.tld as an example.
Feel free to change it.
Now, do this:

cd /var/www
mkdir domain1.nl
mkdir domain2.org

And now, edit “default”.

nano /etc/nginx/sites-available/default

We made a working version of our configuration, so you’ll only need to change the paths and domains.
Note: We give examples for domains with “www.”.
You’ll need to add ones without “www.”.
Changable values are bold.

server {
listen 80;
server_name www.domain1.nl;

location / {
index index.php index.html;
root /var/www/domain1.nl;
}

# # this sends all non-existing file or directory requests to index.php
# if (!-e $request_filename) {
# rewrite ^(.+)$ /index.php?q=$1 last;
# }

location ~ \.php$ {
fastcgi_pass localhost:53217; # port where FastCGI processes were spawned
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain1.nl$fastcgi_script_name; # same path as above

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
}

server {
listen 80;
server_name www.domain2.org;

location / {
index index.php index.html;
root /var/www/domain2.org;
}

# # this sends all non-existing file or directory requests to index.php
# if (!-e $request_filename) {
# rewrite ^(.+)$ /index.php?q=$1 last;
# }

location ~ \.php$ {
fastcgi_pass localhost:53217; # port where FastCGI processes were spawned
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/domain2.org$fastcgi_script_name; # same path as above

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
}
}

That’s all.
Now you have a working configuration!

Source: ElasticDog.com.

On every Debian-based VPS, I get this error message after “mysql -u root -p”.
But how to solve the case?
Here’s the tutorial.

On Debian servers, MySQL doesn’t come with a Root user.
Even though you make a Root user, you’ll still won’t be able to do anything.
Instead, look in your Debian.conf.

nano /etc/mysql/debian.conf

Copy the username and password over to your Text Editor.
And now, log in:

mysql -u username-in-your-conf -ppassword-in-your-conf

Yes, “-p” and the password without spaces.
And you’re in, and you can do anything you want!

Sites affacted: YamiHoshi Story, YamiHoshi Tech, Woondroom Goes, Mario Kart CW Project.
Code: DE001.
Description:

My other server was way to slow with 7 sites/6 domains.
So I had to split the sites: Small sites on VPS1, big sites on VPS2.
As soon as I ordered VPS2, everything has been gone wrong.
It was either a non-working MySQL, non-working OS, non-working Lighttpd, non-working Nginx, or some of them combined.
I hope this will never happen again.

Again, sorry for the huge downtime!