Cannot add second domain to Nginx serverTrouble with nginx and serving from multiple directories under the same domainServing static sites from S3 with nginxhow to set the nginx root path to a direcoty outside the ngnix dirNginx config file only working for ''/"Can not change nginx 1.2.5 default websiteNginx autoindex featureNginx ignores my second server directivenginx configuration troubleCodeIgniter nginx rewrite rules for i8ln URL'sWhy Nginx calls for invalid certificate in non-existent subdomains just to redirect to 404?
Can I ask the recruiters in my resume to put the reason why I am rejected?
Languages that we cannot (dis)prove to be Context-Free
Are the number of citations and number of published articles the most important criteria for a tenure promotion?
Test whether all array elements are factors of a number
TGV timetables / schedules?
Why are electrically insulating heatsinks so rare? Is it just cost?
Modeling an IPv4 Address
How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?
Do I have a twin with permutated remainders?
How do I create uniquely male characters?
Collect Fourier series terms
Why Is Death Allowed In the Matrix?
Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?
tikz: show 0 at the axis origin
"You are your self first supporter", a more proper way to say it
Can I make popcorn with any corn?
What is the word for reserving something for yourself before others do?
Why not use SQL instead of GraphQL?
Mathematical cryptic clues
can i play a electric guitar through a bass amp?
How much RAM could one put in a typical 80386 setup?
What are the differences between the usage of 'it' and 'they'?
How can I make my BBEG immortal short of making them a Lich or Vampire?
Maximum likelihood parameters deviate from posterior distributions
Cannot add second domain to Nginx server
Trouble with nginx and serving from multiple directories under the same domainServing static sites from S3 with nginxhow to set the nginx root path to a direcoty outside the ngnix dirNginx config file only working for ''/"Can not change nginx 1.2.5 default websiteNginx autoindex featureNginx ignores my second server directivenginx configuration troubleCodeIgniter nginx rewrite rules for i8ln URL'sWhy Nginx calls for invalid certificate in non-existent subdomains just to redirect to 404?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a local macOS server with nginx setup to host one domain: ogli.codes (which currently works fine).
Now, I want to add a second domain: api.ogli.codes
. For now, I'd just like to show a simple hello-world-index.html
file.
This is my configuration file for ogli.codes:
server
listen 80;
server_name ogli.codes;
root html/ogli.codes;
index index.html;
So I duplicated that file and simply changed the directory and the server name:
server
listen 80;
server_name api.ogli.codes;
root html/api.ogli.codes;
index index.html;
Then, I added the alias to /sites-enabled and reloaded nginx:
sudo nginx -s stop && sudo nginx
...and added the folder api.ogli.codes in the same directory as ogli.codes is in: /usr/local/var/www/
(yes, this is the correct path, as html
points there directly.
Inside that folder, I created a simple index.html
file saying "It works!"
Now, when I open ogli.codes in the browser, it works just fine, but heading over to api.ogli.codes gives me a 404 not found.
So: the domain properly resolves to my server's IP, but I cannot see my site.
What's also interesting is that I tried to support www.ogli.codes in the first configuration file, by changing the server_name
line to:
server_name ogli.codes www.ogli.codes;
After reloading nginx, I also cannot reach www.ogli.codes. Might those issues have the same root?
What's wrong here?
nginx mac-osx
New contributor
|
show 1 more comment
I have a local macOS server with nginx setup to host one domain: ogli.codes (which currently works fine).
Now, I want to add a second domain: api.ogli.codes
. For now, I'd just like to show a simple hello-world-index.html
file.
This is my configuration file for ogli.codes:
server
listen 80;
server_name ogli.codes;
root html/ogli.codes;
index index.html;
So I duplicated that file and simply changed the directory and the server name:
server
listen 80;
server_name api.ogli.codes;
root html/api.ogli.codes;
index index.html;
Then, I added the alias to /sites-enabled and reloaded nginx:
sudo nginx -s stop && sudo nginx
...and added the folder api.ogli.codes in the same directory as ogli.codes is in: /usr/local/var/www/
(yes, this is the correct path, as html
points there directly.
Inside that folder, I created a simple index.html
file saying "It works!"
Now, when I open ogli.codes in the browser, it works just fine, but heading over to api.ogli.codes gives me a 404 not found.
So: the domain properly resolves to my server's IP, but I cannot see my site.
What's also interesting is that I tried to support www.ogli.codes in the first configuration file, by changing the server_name
line to:
server_name ogli.codes www.ogli.codes;
After reloading nginx, I also cannot reach www.ogli.codes. Might those issues have the same root?
What's wrong here?
nginx mac-osx
New contributor
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
@MichaelHampton this is the only thing I see:2019/04/03 17:49:43 [notice] 42807#0: signal process started
and2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
That means yourroot
directive is not pointing to the directory you think it is.
– Michael Hampton♦
Apr 3 at 16:08
I just tested changing sth. in theindex.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only saysrobots.txt
is missing, which is true, but shouldn't be related to my question.
– LinusGeffarth
Apr 3 at 16:09
api.ogli.codes
points to IP18.191.173.167
whileogli.codes
→185.10.148.214
. Probably you should change your DNS
– Alexey Ten
Apr 3 at 23:00
|
show 1 more comment
I have a local macOS server with nginx setup to host one domain: ogli.codes (which currently works fine).
Now, I want to add a second domain: api.ogli.codes
. For now, I'd just like to show a simple hello-world-index.html
file.
This is my configuration file for ogli.codes:
server
listen 80;
server_name ogli.codes;
root html/ogli.codes;
index index.html;
So I duplicated that file and simply changed the directory and the server name:
server
listen 80;
server_name api.ogli.codes;
root html/api.ogli.codes;
index index.html;
Then, I added the alias to /sites-enabled and reloaded nginx:
sudo nginx -s stop && sudo nginx
...and added the folder api.ogli.codes in the same directory as ogli.codes is in: /usr/local/var/www/
(yes, this is the correct path, as html
points there directly.
Inside that folder, I created a simple index.html
file saying "It works!"
Now, when I open ogli.codes in the browser, it works just fine, but heading over to api.ogli.codes gives me a 404 not found.
So: the domain properly resolves to my server's IP, but I cannot see my site.
What's also interesting is that I tried to support www.ogli.codes in the first configuration file, by changing the server_name
line to:
server_name ogli.codes www.ogli.codes;
After reloading nginx, I also cannot reach www.ogli.codes. Might those issues have the same root?
What's wrong here?
nginx mac-osx
New contributor
I have a local macOS server with nginx setup to host one domain: ogli.codes (which currently works fine).
Now, I want to add a second domain: api.ogli.codes
. For now, I'd just like to show a simple hello-world-index.html
file.
This is my configuration file for ogli.codes:
server
listen 80;
server_name ogli.codes;
root html/ogli.codes;
index index.html;
So I duplicated that file and simply changed the directory and the server name:
server
listen 80;
server_name api.ogli.codes;
root html/api.ogli.codes;
index index.html;
Then, I added the alias to /sites-enabled and reloaded nginx:
sudo nginx -s stop && sudo nginx
...and added the folder api.ogli.codes in the same directory as ogli.codes is in: /usr/local/var/www/
(yes, this is the correct path, as html
points there directly.
Inside that folder, I created a simple index.html
file saying "It works!"
Now, when I open ogli.codes in the browser, it works just fine, but heading over to api.ogli.codes gives me a 404 not found.
So: the domain properly resolves to my server's IP, but I cannot see my site.
What's also interesting is that I tried to support www.ogli.codes in the first configuration file, by changing the server_name
line to:
server_name ogli.codes www.ogli.codes;
After reloading nginx, I also cannot reach www.ogli.codes. Might those issues have the same root?
What's wrong here?
nginx mac-osx
nginx mac-osx
New contributor
New contributor
New contributor
asked Apr 3 at 15:56
LinusGeffarthLinusGeffarth
1086
1086
New contributor
New contributor
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
@MichaelHampton this is the only thing I see:2019/04/03 17:49:43 [notice] 42807#0: signal process started
and2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
That means yourroot
directive is not pointing to the directory you think it is.
– Michael Hampton♦
Apr 3 at 16:08
I just tested changing sth. in theindex.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only saysrobots.txt
is missing, which is true, but shouldn't be related to my question.
– LinusGeffarth
Apr 3 at 16:09
api.ogli.codes
points to IP18.191.173.167
whileogli.codes
→185.10.148.214
. Probably you should change your DNS
– Alexey Ten
Apr 3 at 23:00
|
show 1 more comment
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
@MichaelHampton this is the only thing I see:2019/04/03 17:49:43 [notice] 42807#0: signal process started
and2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
That means yourroot
directive is not pointing to the directory you think it is.
– Michael Hampton♦
Apr 3 at 16:08
I just tested changing sth. in theindex.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only saysrobots.txt
is missing, which is true, but shouldn't be related to my question.
– LinusGeffarth
Apr 3 at 16:09
api.ogli.codes
points to IP18.191.173.167
whileogli.codes
→185.10.148.214
. Probably you should change your DNS
– Alexey Ten
Apr 3 at 23:00
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
@MichaelHampton this is the only thing I see:
2019/04/03 17:49:43 [notice] 42807#0: signal process started
and 2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
@MichaelHampton this is the only thing I see:
2019/04/03 17:49:43 [notice] 42807#0: signal process started
and 2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
That means your
root
directive is not pointing to the directory you think it is.– Michael Hampton♦
Apr 3 at 16:08
That means your
root
directive is not pointing to the directory you think it is.– Michael Hampton♦
Apr 3 at 16:08
I just tested changing sth. in the
index.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only says robots.txt
is missing, which is true, but shouldn't be related to my question.– LinusGeffarth
Apr 3 at 16:09
I just tested changing sth. in the
index.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only says robots.txt
is missing, which is true, but shouldn't be related to my question.– LinusGeffarth
Apr 3 at 16:09
api.ogli.codes
points to IP 18.191.173.167
while ogli.codes
→ 185.10.148.214
. Probably you should change your DNS– Alexey Ten
Apr 3 at 23:00
api.ogli.codes
points to IP 18.191.173.167
while ogli.codes
→ 185.10.148.214
. Probably you should change your DNS– Alexey Ten
Apr 3 at 23:00
|
show 1 more comment
0
active
oldest
votes
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
);
);
LinusGeffarth is a new contributor. Be nice, and check out our Code of Conduct.
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%2f961330%2fcannot-add-second-domain-to-nginx-server%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
LinusGeffarth is a new contributor. Be nice, and check out our Code of Conduct.
LinusGeffarth is a new contributor. Be nice, and check out our Code of Conduct.
LinusGeffarth is a new contributor. Be nice, and check out our Code of Conduct.
LinusGeffarth is a new contributor. Be nice, and check out our Code of Conduct.
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%2f961330%2fcannot-add-second-domain-to-nginx-server%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
Check the error log.
– Michael Hampton♦
Apr 3 at 16:01
@MichaelHampton this is the only thing I see:
2019/04/03 17:49:43 [notice] 42807#0: signal process started
and2019/04/03 18:00:50 [error] 42811#0: *15 open() "/usr/local/Cellar/nginx/1.15.9/html/ogli.codes/robots.txt" failed (2: No such file or directory), client: 94.130.167.104, server: ogli.codes, request: "GET /robots.txt HTTP/1.1", host: "ogli.codes"
– LinusGeffarth
Apr 3 at 16:07
That means your
root
directive is not pointing to the directory you think it is.– Michael Hampton♦
Apr 3 at 16:08
I just tested changing sth. in the
index.html
for ogli.codes (the once that works) and I immediately saw the change on the server when refreshing the page. Note that this only saysrobots.txt
is missing, which is true, but shouldn't be related to my question.– LinusGeffarth
Apr 3 at 16:09
api.ogli.codes
points to IP18.191.173.167
whileogli.codes
→185.10.148.214
. Probably you should change your DNS– Alexey Ten
Apr 3 at 23:00