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?

Multi tool use
Multi tool use

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;








0















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?










share|improve this question







New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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












  • 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












  • api.ogli.codes points to IP 18.191.173.167 while ogli.codes185.10.148.214. Probably you should change your DNS

    – Alexey Ten
    Apr 3 at 23:00

















0















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?










share|improve this question







New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • 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












  • 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












  • api.ogli.codes points to IP 18.191.173.167 while ogli.codes185.10.148.214. Probably you should change your DNS

    – Alexey Ten
    Apr 3 at 23:00













0












0








0








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?










share|improve this question







New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question







New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 3 at 15:56









LinusGeffarthLinusGeffarth

1086




1086




New contributor




LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






LinusGeffarth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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












  • 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












  • api.ogli.codes points to IP 18.191.173.167 while ogli.codes185.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











  • @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











  • 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.codes185.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.codes185.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.codes185.10.148.214. Probably you should change your DNS

– Alexey Ten
Apr 3 at 23:00










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.









draft saved

draft discarded


















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.









draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































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







Qk5,O,m22om8,ZHtI
VtejnluY

Popular posts from this blog

RemoteApp sporadic failureWindows 2008 RemoteAPP client disconnects within a matter of minutesWhat is the minimum version of RDP supported by Server 2012 RDS?How to configure a Remoteapp server to increase stabilityMicrosoft RemoteApp Active SessionRDWeb TS connection broken for some users post RemoteApp certificate changeRemote Desktop Licensing, RemoteAPPRDS 2012 R2 some users are not able to logon after changed date and time on Connection BrokersWhat happens during Remote Desktop logon, and is there any logging?After installing RDS on WinServer 2016 I still can only connect with two users?RD Connection via RDGW to Session host is not connecting

Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020