LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-20-2010, 01:48 PM   #1
karelkap
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
Question how to config NGINX for multiple domains with wordpress on Debian?


Ok, so I have VPS installed with Debian, NGINX, mysql, php and wordpress. By default the template gives 1 wordpress install in the /var/www/ directory.
However, now I want to add more domains with wordpress to that VPS.

I created a directory called /home/public_html/domain1.com and linked it to the /var/www/ directory.
then I created another directory called /home/public_html/domain2.com and uploaded wordpress there.

What I did next was edit my /etc/nginx/nginx.conf file with the following code:

Code:
user www-data www-data;
worker_processes  4;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     off;
    keepalive_timeout  5;

    gzip  on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types      text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

server  {
            listen       80;
            server_name  localhost;

            location /  {
                    root   html;
                    index  index.php index.html index.htm;
                           }

            # redirect server error pages to the static page /50x.html
            error_page   500 502 503 504  /50x.html;
            location = /50x.html
                           {
                                root   html;
                           }
                }

server {
            listen   80;
            server_name  www.domain1.com;
            rewrite ^/(.*) http://domain1.com/$1 permanent;
       }

server { listen 80; server_name domain2.com; rewrite ^/(.*) http://www.domain2.com/$1 permanent; }
server {
            listen   80;
            server_name *.domain1.com domain1.com www.domain2.com *.domain2.com;

            location /  {
                        root   /home/public_html/$host/;
                        index  index.php index.html;
                        include /etc/nginx/wordpress_params.regular;
                        }

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            location ~ \.php$
                                {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include /etc/nginx/fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /home/public_html/$host/$fastcgi_script_name;
                        }
       }


}
there are rewrite rules there because I want domain1.com to always display as http://domain1.com and domain2.com always as http://www.domain2.com

and the /etc/nginx/wordpress_params.regular contains the following to enable pretty urls in wordpress.

Code:
# WordPress pretty URLs: (as per dominiek.com)
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;
# Enable nice permalinks for WordPress: (as per Yawn.it)
error_page  404  = //index.php?q=$uri;
The problem however is that when I go to domain2.com it doesnt work, it display this error message: No input file specified.
domain1.com works fine..

Any idea whats wrong?

Thanks.
PS. im quite a newb so might be missing something simple here:)
 
Old 06-21-2010, 11:21 AM   #2
karelkap
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Seems like the problem was that i need to make a directory called www.domain2.com instead of domain2.com
 
  


Reply

Tags
debian, nginx, wordpress


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 - having trouble setting up multiple domains under debian etch walterbyrd Linux - Software 3 01-08-2010 07:03 PM
Multiple emails accounts(with different from domains) on multiple domains on 1 server locoputo Linux - Server 0 04-12-2009 06:29 PM
Multiple domains in LDAP and 1 samba server for all domains, what to do? xnomad Linux - Server 1 11-14-2008 09:12 AM
Sub Domains & Multiple Domains (Apache) lugos Linux - Server 1 09-01-2006 10:22 PM
Installing Wordpress into multiple directories oadvantage General 2 04-28-2006 04:34 PM


All times are GMT -5. The time now is 08:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration