Nginx Multiple DomainsHow do I get PHP 5.3.3 working with Nginx on CentOS 5.5?Blank Page: wordpress on nginx+php-fpmNginx gives 504 Gateway Time-out once moved to liveNginx subversion commit failurenginx php5-fpm path_info urls and root locationNGINX don't parse .php5 as .phpLaravel 4.1 on nginx routes error 404CodeIgniter nginx rewrite rules for i8ln URL'sHow to configure nginx to serve one site from two different document root and using different php depending on URLlimit_req_zone for the whole PHP
Why is B♯ higher than C♭ in 31-ET?
How important is people skills in academic career and applications?
Are there any Final Fantasy Spirits in Super Smash Bros Ultimate?
What was the design of the Macintosh II's MMU replacement?
How long would it take for people to notice a mass disappearance?
Missing Piece of Pie - Can you find it?
How does this change to the opportunity attack rule impact combat?
Is latino sine flexione dead?
Can Infinity Stones be retrieved more than once?
Why is "Vayechulu" said 3 times on Leil Shabbat?
Which module had more 'comfort' in terms of living space, the Lunar Module or the Command module?
Upside-Down Pyramid Addition...REVERSED!
How wide is a neg symbol, how to get the width for alignment?
As matter approaches a black hole, does it speed up?
Can you complete the sequence?
Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?
How can I get a job without pushing my family's income into a higher tax bracket?
why do people keep saying me that I am a horrible photographer?
Why are prions in animal diets not destroyed by the digestive system?
Shantae Dance Matching
What does a spell range of "25 ft. + 5 ft./2 levels" mean?
Expressing 'our' for objects belonging to our apartment
BOOM! Perfect Clear for Mr. T
Have I damaged my car by attempting to reverse with hand/park brake up?
Nginx Multiple Domains
How do I get PHP 5.3.3 working with Nginx on CentOS 5.5?Blank Page: wordpress on nginx+php-fpmNginx gives 504 Gateway Time-out once moved to liveNginx subversion commit failurenginx php5-fpm path_info urls and root locationNGINX don't parse .php5 as .phpLaravel 4.1 on nginx routes error 404CodeIgniter nginx rewrite rules for i8ln URL'sHow to configure nginx to serve one site from two different document root and using different php depending on URLlimit_req_zone for the whole PHP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to add a second virtual host to nginx. When i go to the new domain it redirects to the old one. I have tried restarting Nginx, rebooting the server.
Has anyone come across this before, care to share?
File: 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/*;
File: ../sites-enabled/domain1.co.uk
server
listen 80;
server_name www.domain1.co.uk;
rewrite ^/(.*) http://domain1.co.uk/$1 permanent;
server
listen 80;
server_name domain1.co.uk;
access_log /home/me/public_html/domain1.co.uk/log/access.log;
error_log /home/me/public_html/domain1.co.uk/log/error.log;
location /
root /home/me/public_html/domain1.co.uk/public/;
index index.php index.html;
# WordPress supercache & permalinks.
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/me/public_html/domain1.co.uk/public/$fastcgi_script_name;
File: ../sites-enabled/domain2.co.uk
server
listen 80;
server_name www.domain2.co.uk;
rewrite ^/(.*) http://domain2.co.uk/$1 permanent;
server
listen 80;
server_name domain2.co.uk;
access_log /home/me/public_html/domain2.co.uk/log/access.log;
error_log /home/me/public_html/domain2.co.uk/log/error.log;
location /
root /home/me/public_html/domain2.co.uk/public/;
index index.php index.html;
# Basic version of WordPress parameters, supporting nice permalinks.
# include /usr/local/nginx/conf/wordpress_params.regular;
# Advanced version of WordPress parameters supporting nice permalinks and WP Super Cache plugin
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/me/public_html/domain2/public/$fastcgi_script_name;
nginx virtualhost redirect hostname
|
show 3 more comments
I am trying to add a second virtual host to nginx. When i go to the new domain it redirects to the old one. I have tried restarting Nginx, rebooting the server.
Has anyone come across this before, care to share?
File: 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/*;
File: ../sites-enabled/domain1.co.uk
server
listen 80;
server_name www.domain1.co.uk;
rewrite ^/(.*) http://domain1.co.uk/$1 permanent;
server
listen 80;
server_name domain1.co.uk;
access_log /home/me/public_html/domain1.co.uk/log/access.log;
error_log /home/me/public_html/domain1.co.uk/log/error.log;
location /
root /home/me/public_html/domain1.co.uk/public/;
index index.php index.html;
# WordPress supercache & permalinks.
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/me/public_html/domain1.co.uk/public/$fastcgi_script_name;
File: ../sites-enabled/domain2.co.uk
server
listen 80;
server_name www.domain2.co.uk;
rewrite ^/(.*) http://domain2.co.uk/$1 permanent;
server
listen 80;
server_name domain2.co.uk;
access_log /home/me/public_html/domain2.co.uk/log/access.log;
error_log /home/me/public_html/domain2.co.uk/log/error.log;
location /
root /home/me/public_html/domain2.co.uk/public/;
index index.php index.html;
# Basic version of WordPress parameters, supporting nice permalinks.
# include /usr/local/nginx/conf/wordpress_params.regular;
# Advanced version of WordPress parameters supporting nice permalinks and WP Super Cache plugin
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/me/public_html/domain2/public/$fastcgi_script_name;
nginx virtualhost redirect hostname
4
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
3
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35
|
show 3 more comments
I am trying to add a second virtual host to nginx. When i go to the new domain it redirects to the old one. I have tried restarting Nginx, rebooting the server.
Has anyone come across this before, care to share?
File: 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/*;
File: ../sites-enabled/domain1.co.uk
server
listen 80;
server_name www.domain1.co.uk;
rewrite ^/(.*) http://domain1.co.uk/$1 permanent;
server
listen 80;
server_name domain1.co.uk;
access_log /home/me/public_html/domain1.co.uk/log/access.log;
error_log /home/me/public_html/domain1.co.uk/log/error.log;
location /
root /home/me/public_html/domain1.co.uk/public/;
index index.php index.html;
# WordPress supercache & permalinks.
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/me/public_html/domain1.co.uk/public/$fastcgi_script_name;
File: ../sites-enabled/domain2.co.uk
server
listen 80;
server_name www.domain2.co.uk;
rewrite ^/(.*) http://domain2.co.uk/$1 permanent;
server
listen 80;
server_name domain2.co.uk;
access_log /home/me/public_html/domain2.co.uk/log/access.log;
error_log /home/me/public_html/domain2.co.uk/log/error.log;
location /
root /home/me/public_html/domain2.co.uk/public/;
index index.php index.html;
# Basic version of WordPress parameters, supporting nice permalinks.
# include /usr/local/nginx/conf/wordpress_params.regular;
# Advanced version of WordPress parameters supporting nice permalinks and WP Super Cache plugin
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/me/public_html/domain2/public/$fastcgi_script_name;
nginx virtualhost redirect hostname
I am trying to add a second virtual host to nginx. When i go to the new domain it redirects to the old one. I have tried restarting Nginx, rebooting the server.
Has anyone come across this before, care to share?
File: 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/*;
File: ../sites-enabled/domain1.co.uk
server
listen 80;
server_name www.domain1.co.uk;
rewrite ^/(.*) http://domain1.co.uk/$1 permanent;
server
listen 80;
server_name domain1.co.uk;
access_log /home/me/public_html/domain1.co.uk/log/access.log;
error_log /home/me/public_html/domain1.co.uk/log/error.log;
location /
root /home/me/public_html/domain1.co.uk/public/;
index index.php index.html;
# WordPress supercache & permalinks.
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/me/public_html/domain1.co.uk/public/$fastcgi_script_name;
File: ../sites-enabled/domain2.co.uk
server
listen 80;
server_name www.domain2.co.uk;
rewrite ^/(.*) http://domain2.co.uk/$1 permanent;
server
listen 80;
server_name domain2.co.uk;
access_log /home/me/public_html/domain2.co.uk/log/access.log;
error_log /home/me/public_html/domain2.co.uk/log/error.log;
location /
root /home/me/public_html/domain2.co.uk/public/;
index index.php index.html;
# Basic version of WordPress parameters, supporting nice permalinks.
# include /usr/local/nginx/conf/wordpress_params.regular;
# Advanced version of WordPress parameters supporting nice permalinks and WP Super Cache plugin
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/me/public_html/domain2/public/$fastcgi_script_name;
nginx virtualhost redirect hostname
nginx virtualhost redirect hostname
edited Apr 28 '11 at 17:10
showFocus
asked Apr 28 '11 at 2:20
showFocusshowFocus
13114
13114
4
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
3
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35
|
show 3 more comments
4
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
3
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35
4
4
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
3
3
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35
|
show 3 more comments
2 Answers
2
active
oldest
votes
Try removing extra slash from fastcgi_param SCRIPT_FILENAME, so the line would be:
/home/me/public_html/domain2/public$fastcgi_script_name;
add a comment |
I put an index.php page in my directory and accessed it through the browser. No redirect occurred. So it seems if nginx does not find what it is looking for it redirects to another domain.
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f264158%2fnginx-multiple-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try removing extra slash from fastcgi_param SCRIPT_FILENAME, so the line would be:
/home/me/public_html/domain2/public$fastcgi_script_name;
add a comment |
Try removing extra slash from fastcgi_param SCRIPT_FILENAME, so the line would be:
/home/me/public_html/domain2/public$fastcgi_script_name;
add a comment |
Try removing extra slash from fastcgi_param SCRIPT_FILENAME, so the line would be:
/home/me/public_html/domain2/public$fastcgi_script_name;
Try removing extra slash from fastcgi_param SCRIPT_FILENAME, so the line would be:
/home/me/public_html/domain2/public$fastcgi_script_name;
answered Nov 13 '13 at 14:16
Andrei MikhaltsovAndrei Mikhaltsov
2,34411729
2,34411729
add a comment |
add a comment |
I put an index.php page in my directory and accessed it through the browser. No redirect occurred. So it seems if nginx does not find what it is looking for it redirects to another domain.
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
add a comment |
I put an index.php page in my directory and accessed it through the browser. No redirect occurred. So it seems if nginx does not find what it is looking for it redirects to another domain.
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
add a comment |
I put an index.php page in my directory and accessed it through the browser. No redirect occurred. So it seems if nginx does not find what it is looking for it redirects to another domain.
I put an index.php page in my directory and accessed it through the browser. No redirect occurred. So it seems if nginx does not find what it is looking for it redirects to another domain.
answered Apr 28 '11 at 17:42
showFocusshowFocus
13114
13114
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
add a comment |
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
4
4
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
Have you looked at the Nginx logs to verify that that's really what's happening? There's nothing in your posted configuration to tell Nginx to redirect any requests. If it doesn't find what it is looking for, it should return a 404.
– pjmorse
Apr 29 '11 at 16:15
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f264158%2fnginx-multiple-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Define "redirects". Do you get an actual redirect where the address in the bar changes, or does it just load the wrong content? Posting your config, removing sensitive chunks, would help.
– Shane Madden♦
Apr 28 '11 at 2:53
It's hard to say anything without looking at the Nginx config
– Alexander Azarov
Apr 28 '11 at 8:18
Yes the address bar actually changes. From domain2.co.uk to domain1.co.uk
– showFocus
Apr 28 '11 at 11:55
3
Your posted config does not do this. Most likely when you removed information about the domain you fixed the actual problem.
– Martin Fjordvald
Apr 28 '11 at 12:23
So I should double check the domain names in my config files and make sure they are correct?
– showFocus
Apr 28 '11 at 12:35