Configuring multiple domain in nginx in one fileTrouble with nginx and serving from multiple directories...
What do *foreign films* mean for an American?
Finitely many repeated replacements
Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?
Why is there an extra space when I type "ls" in the Desktop directory?
Shifting between bemols and diesis in the key signature
Is it possible to avoid unpacking when merging Association?
How does Ehrenfest's theorem apply to the quantum harmonic oscillator?
What would be the most expensive material to an intergalactic society?
How do spaceships determine each other's mass in space?
Is this Paypal Github SDK reference really a dangerous site?
Virginia employer terminated employee and wants signing bonus returned
Is it a Cyclops number? "Nobody" knows!
Are all players supposed to be able to see each others' character sheets?
What is the population of Romulus in the TNG era?
After `ssh` without `-X` to a machine, is it possible to change `$DISPLAY` to make it work like `ssh -X`?
Can we track matter through time by looking at different depths in space?
In the late 1940’s to early 1950’s what technology was available that could melt ice?
How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?
Is it possible to find 2014 distinct positive integers whose sum is divisible by each of them?
What is this diamond of every day?
Windows Server Data Center Edition - Unlimited Virtual Machines
From an axiomatic set theoric approach why can we take uncountable unions?
Is a piano played in the same way as a harmonium?
Having the player face themselves after the mid-game
Configuring multiple domain in nginx in one file
Trouble with nginx and serving from multiple directories under the same domainNginx password protect one domain and avoid config duplicationnginx ssl proxy for one hostname onlyProperly setting up a “default” nginx server for httpsNginx, reverse proxy to 2 different Joomla sitesnginx PHP files downloading instead of executingApply location directives to subdomains and sub-subdomains on NGINX“competing” nginx configuration filesWhy Nginx calls for invalid certificate in non-existent subdomains just to redirect to 404?configuring nginx + symfony on internal location in existing site
I am still newbie configuring nginx.
Is it posibble to configure multiple domain in one file and they share mostly the same config?
For example I want to configure two domains that based from one app and
one domain need basic auth, the other doesn't.
I would like to do something like this,
but I think this does not work:
sites-enabled/mysite
server {
listen 127.0.0.1:80 default_server;
server_name www.mysite.com;
include sharedconf.conf;
}
server {
listen 127.0.0.1:80;
server_name www.mysite.co.jp;
auth_basic "restricted";
auth_basic_user_file /etc/nginx.htpasswd;
include sharedconf.conf;
}
sharedconf.conf
location / {
proxy_pass_header Server;
#... bunch of config line ...
}
nginx
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am still newbie configuring nginx.
Is it posibble to configure multiple domain in one file and they share mostly the same config?
For example I want to configure two domains that based from one app and
one domain need basic auth, the other doesn't.
I would like to do something like this,
but I think this does not work:
sites-enabled/mysite
server {
listen 127.0.0.1:80 default_server;
server_name www.mysite.com;
include sharedconf.conf;
}
server {
listen 127.0.0.1:80;
server_name www.mysite.co.jp;
auth_basic "restricted";
auth_basic_user_file /etc/nginx.htpasswd;
include sharedconf.conf;
}
sharedconf.conf
location / {
proxy_pass_header Server;
#... bunch of config line ...
}
nginx
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14
add a comment |
I am still newbie configuring nginx.
Is it posibble to configure multiple domain in one file and they share mostly the same config?
For example I want to configure two domains that based from one app and
one domain need basic auth, the other doesn't.
I would like to do something like this,
but I think this does not work:
sites-enabled/mysite
server {
listen 127.0.0.1:80 default_server;
server_name www.mysite.com;
include sharedconf.conf;
}
server {
listen 127.0.0.1:80;
server_name www.mysite.co.jp;
auth_basic "restricted";
auth_basic_user_file /etc/nginx.htpasswd;
include sharedconf.conf;
}
sharedconf.conf
location / {
proxy_pass_header Server;
#... bunch of config line ...
}
nginx
I am still newbie configuring nginx.
Is it posibble to configure multiple domain in one file and they share mostly the same config?
For example I want to configure two domains that based from one app and
one domain need basic auth, the other doesn't.
I would like to do something like this,
but I think this does not work:
sites-enabled/mysite
server {
listen 127.0.0.1:80 default_server;
server_name www.mysite.com;
include sharedconf.conf;
}
server {
listen 127.0.0.1:80;
server_name www.mysite.co.jp;
auth_basic "restricted";
auth_basic_user_file /etc/nginx.htpasswd;
include sharedconf.conf;
}
sharedconf.conf
location / {
proxy_pass_header Server;
#... bunch of config line ...
}
nginx
nginx
asked Aug 22 '14 at 14:06
mhdmhd
318138
318138
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14
add a comment |
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14
add a comment |
1 Answer
1
active
oldest
votes
Yes, this works fine.
I am assuming that you are using Debian or Debian derived Linux distribution. Then you cannot put sharedconf.conf
into /etc/nginx/sites-enabled
nor into /etc/nginx/conf.d
, since files in those directories are included in main nginx.conf
on Debian.
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
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%2f623327%2fconfiguring-multiple-domain-in-nginx-in-one-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Yes, this works fine.
I am assuming that you are using Debian or Debian derived Linux distribution. Then you cannot put sharedconf.conf
into /etc/nginx/sites-enabled
nor into /etc/nginx/conf.d
, since files in those directories are included in main nginx.conf
on Debian.
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
add a comment |
Yes, this works fine.
I am assuming that you are using Debian or Debian derived Linux distribution. Then you cannot put sharedconf.conf
into /etc/nginx/sites-enabled
nor into /etc/nginx/conf.d
, since files in those directories are included in main nginx.conf
on Debian.
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
add a comment |
Yes, this works fine.
I am assuming that you are using Debian or Debian derived Linux distribution. Then you cannot put sharedconf.conf
into /etc/nginx/sites-enabled
nor into /etc/nginx/conf.d
, since files in those directories are included in main nginx.conf
on Debian.
Yes, this works fine.
I am assuming that you are using Debian or Debian derived Linux distribution. Then you cannot put sharedconf.conf
into /etc/nginx/sites-enabled
nor into /etc/nginx/conf.d
, since files in those directories are included in main nginx.conf
on Debian.
answered Aug 23 '14 at 2:20
Tero KilkanenTero Kilkanen
20.4k22644
20.4k22644
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
add a comment |
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
Yep, create directory like /etc/nginx/shared/ and include it via full-path. It should work without any problems. Just check permissions on directory and files
– Navern
Aug 23 '14 at 23:14
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%2f623327%2fconfiguring-multiple-domain-in-nginx-in-one-file%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
The basic logic behind 2 vhosts in one file and both sharing an 'includes' sounds fine. Can you elaborate on what happens you try this configuration?
– Peter
Aug 22 '14 at 14:14