Hosting two wordpress sites - vhosts
-
I can't seem to get this working. I have the first site running nicely, but the second, after following the tutorial, simply redirects to the first domain when I try to hit it in the browser.
Is there anything I may be missing?
Are there any common troubleshooting steps for this type of issue?
Thanks all,
GaryPosted 1 year ago # -
Hi Gary
I would start by checking you have followed everything here:
http://vpsbible.com/web-servers/nginx-add-domains/
If after doing this you still have issues you will need to start posting your config files etc so we can spot any obvious issues.
Posted 1 year ago # -
Thanks Andy. I'm still having issues...posting config files:
/usr/local/nginx/conf/nginx.conf
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; include /usr/local/nginx/sites-enabled/*; }vhosts for second domain:
server { listen 80; server_name caribbeanbeachweddings.com; rewrite ^/(.*) http://www.caribbeanbeachweddings.com/$1 permanent; } server { listen 80; server_name http://www.caribbeanbeachweddings.com; access_log /home/rws/public_html/caribbeanbeachweddings.com/log/access.log; error_log /home/rws/public_html/caribbeanbeachweddings.com/log/error.log; location / { root /home/rws/public_html/caribbeanbeachweddings.com/public/; index index.php index.html; include /usr/local/nginx/conf/wordpress_params.super_cache; } # 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 /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/rws/public_html/caribbeanbeachweddings.com/public/$fastcgi_script_name; } } Not sure if I should be posting any other files. Thanks in advance for the help.Posted 1 year ago # -
I think it is much cleaner of you create vhosts files instead of adding them to the nginx configuration file. For example /usr/local/nginx/sites-available/caribbeanbeachweddings.com is where your vhost file should be that contains your vhost configuration. Then your carribbeanbeachweddings.com vhost file should include something like this
server { listen 80; server_name caribbeanbeachweddings.com; access_log /home/rws/public_html/caribbeanbeachweddings.com/log/access.log; error_log /home/rws/public_html/caribbeanbeachweddings.com/log/error.log; # Set this to off if you're hosting more than one site server_name_in_redirect off; location / { root /home/rws/public_html/caribbeanbeachweddings.com/public/; index index.php index.html; } # 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 /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/rws/public_html/caribbeanbeachweddings.com/public/$fastcgi_script_name; } }Some things above may need to be tweaked accordingly. Also, you will need to do a symlink of the vhost file to /usr/local/nginx/sites-enabled/caribbeanbeachweddings.com
Posted 1 year ago # -
Hey Josh, thanks for the reply. I don't understand, are you recommending I do it in a way that is different from the tutorial I paid for on this site?
I'd like to hear from the_guv about whether the tutorial should be changed as you suggested, or If I should try something else..
I did do the symlink, also as suggested by the tutorial on this site. No luck.
Thanks again for the replies...still troubleshootingPosted 1 year ago # -
No, not at all, I am suggesting the same that is on this page: http://vpsbible.com/web-servers/nginx-add-domains/ I am only saying that what goes in your vhost should be separated from what goes in your nginx.conf file because it looked like you were including vhost info into that file or maybe I was reading your post wrong.
Posted 1 year ago # -
it is...see my post above your original...
the first code block is the nginx.conf (in which the final line is an include statement for the vhosts file.
The second block, is the actual vhosts file..
(which i think is what you meant, and is what the tutorial says to do)
Posted 1 year ago # -
Gotcha. Ok, so you have /usr/local/nginx/sites-available/caribbeanbeachweddings.com and /usr/local/nginx/sites-enabled/caribbeanbeachweddings.com
Are you using bind9 or mybind? If so, did you add a master bind zone for this site?
Posted 1 year ago # -
I don't think so (not sure how to check). I checked the tutorials I completed (including the one you posted) and i didn't see any reference to bind9 or mybind, so no, I don't think I'm using any, and I don't think I made a master bind zone...
Is that a requirement I may have missed?
Thanks again for all the help!
Posted 1 year ago # -
Sorry, no I don't think that is a requirement. I am just asking questions to see what kind of server you have in order to help you troubleshoot. That is the only thing that I can think of, so the_guv will probably have a better answer for your situation.
Posted 1 year ago # -
Sorry, let me give more details (im horrible at that)
I followed the ubuntu - nginx guide here called "Setup Unmanaged VPS: The Ubuntu-Nginx Guide" (http://vpsbible.com/vps-setup-guides/ubuntu-nginx-vps-setup-guide/) - all 22 steps or so, and I stuck to the defaults suggested.
I'm getting crazy here, I'm sure it's something tiny I'm missing.
..and thanks again, I really do appreciate your attempts to talk me through the troubleshooting.
Posted 1 year ago # -
Do you have a VPS or dedicated server? Are you using the Linode service or some other hosting company?
Posted 1 year ago # -
vps on linode.
Posted 1 year ago # -
i just loaded caribbeanbeachweddings.com and it says Error establishing a database connection.
Posted 1 year ago # -
hmmmm, could it have simply taken 2 days for the dns changes to propagate?
actually trying it now and it's still redirecting to billiard.ws (the first domain I set up on that linode)
Posted 1 year ago # -
@Gary, I noticed that yesterday. When I go to caribbeanbeachweddings.com, I am redirected to http://www.caribbeanbeachweddings.com
Posted 1 year ago # -
ok! I've got it worked out to having only one last problem (should hopefully be an easy one)
Typing http://www.caribbeanbeachweddings.com directs to the correct place.
BUT
http://caribbeanbeachweddings.com (without the www) still redirects to http://www.billiard.ws
where can I find that definition and make the change so that the non-www version directs appropriately?
Posted 1 year ago # -
I just checked your site and seems as both are being directed to the right place.
Posted 1 year ago # -
http://caribbeanbeachweddings.com goes to www now .. post up the vhosts again Gary .. i guess they've changed from above, huh?
Posted 1 year ago # -
no, the sites just look the same, because there are default wordpress installs at each.
typing http://caribbeanbeachweddings.com takes me to http://www.billiard.ws. Typing the http://www.caribbeanbeachweddings.com/ takes me to http://www.caribbeanbeachweddings.com.
here is the caribbeanbeachweddings.com vhosts file:
server { listen 80; server_name caribbeanbeachweddings.com; rewrite ^/(.*) http://www.caribbeanbeachweddings.com/$1 permanent; } server { listen 80; server_name http://www.caribbeanbeachweddings.com; access_log /home/rws/public_html/caribbeanbeachweddings.com/log/access.log; error_log /home/rws/public_html/caribbeanbeachweddings.com/log/error.log; location / { root /home/rws/public_html/caribbeanbeachweddings.com/public/; index index.php index.html; include /usr/local/nginx/conf/wordpress_params.super_cache; } # 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 /usr/local/nginx/conf/fastcgi_params; fastcgi_param SCRIPT_FILENAME /home/rws/public_html/caribbeanbeachweddings.com/public/$fastcgi_script_name; } }Posted 1 year ago # -
christ my browser was caching the old one. The minute I tried it in a different browser, it worked...weird...
what was causing it to do that...Posted 1 year ago #
Reply
You must log in to post.
Want HTML?
a blockquote code em strong ul ol liPlace code between backticks `codeHere`
You've got it.
