nginx : simple configuration with proxy_pass fail Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Come Celebrate our 10 Year Anniversary!Help needed setting up nginx to serve static filesBlank Page: wordpress on nginx+php-fpmnginx redirect issue with upstream configurationnginx : backend https, proxy_pass shows ipProperly setting up a “default” nginx server for httpsnginx proxy_pass eventually returns GATEWAY_TIMEOUT even though server is still activenginx proxy_pass is being ignoredConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errorsWhy is Nginx displaying a “502 Bad Gateway Error”?
What was the last profitable war?
Why are two-digit numbers in Jonathan Swift's "Gulliver's Travels" (1726) written in "German style"?
Was the pager message from Nick Fury to Captain Marvel unnecessary?
In musical terms, what properties are varied by the human voice to produce different words / syllables?
As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?
Sally's older brother
malloc in main() or malloc in another function: allocating memory for a struct and its members
By what mechanism was the 2017 UK General Election called?
Why does BitLocker not use RSA?
Is the time—manner—place ordering of adverbials an oversimplification?
Can two people see the same photon?
Inverse square law not accurate for non-point masses?
Where did Ptolemy compare the Earth to the distance of fixed stars?
NIntegrate on a solution of a matrix ODE
Keep at all times, the minus sign above aligned with minus sign below
Problem with display of presentation
Understanding piped commands in GNU/Linux
Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?
Did any compiler fully use 80-bit floating point?
Centre cell vertically in tabularx
Fit odd number of triplets in a measure?
Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?
What is the proper term for etching or digging of wall to hide conduit of cables
One-one communication
nginx : simple configuration with proxy_pass fail
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Help needed setting up nginx to serve static filesBlank Page: wordpress on nginx+php-fpmnginx redirect issue with upstream configurationnginx : backend https, proxy_pass shows ipProperly setting up a “default” nginx server for httpsnginx proxy_pass eventually returns GATEWAY_TIMEOUT even though server is still activenginx proxy_pass is being ignoredConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errorsWhy is Nginx displaying a “502 Bad Gateway Error”?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I try a simple configuration with an nginx v1.10.13. The configuration :
events
http
server
listen 80;
location = /loc1
proxy_pass http://192.168.0.5:80/;
and try this configuration with curl --data "param1=XXX" -X POST http://192.168.0.4:80/loc1
I watch 192.168.0.5
incoming connection and nothing come.
I really don't understand what is wrong, the configuration is very simple. I match all connexion on port 80
, and all loc1
location. So why my curl command fail ? curl command return Not found: /
...
nginx
New contributor
add a comment |
I try a simple configuration with an nginx v1.10.13. The configuration :
events
http
server
listen 80;
location = /loc1
proxy_pass http://192.168.0.5:80/;
and try this configuration with curl --data "param1=XXX" -X POST http://192.168.0.4:80/loc1
I watch 192.168.0.5
incoming connection and nothing come.
I really don't understand what is wrong, the configuration is very simple. I match all connexion on port 80
, and all loc1
location. So why my curl command fail ? curl command return Not found: /
...
nginx
New contributor
add a comment |
I try a simple configuration with an nginx v1.10.13. The configuration :
events
http
server
listen 80;
location = /loc1
proxy_pass http://192.168.0.5:80/;
and try this configuration with curl --data "param1=XXX" -X POST http://192.168.0.4:80/loc1
I watch 192.168.0.5
incoming connection and nothing come.
I really don't understand what is wrong, the configuration is very simple. I match all connexion on port 80
, and all loc1
location. So why my curl command fail ? curl command return Not found: /
...
nginx
New contributor
I try a simple configuration with an nginx v1.10.13. The configuration :
events
http
server
listen 80;
location = /loc1
proxy_pass http://192.168.0.5:80/;
and try this configuration with curl --data "param1=XXX" -X POST http://192.168.0.4:80/loc1
I watch 192.168.0.5
incoming connection and nothing come.
I really don't understand what is wrong, the configuration is very simple. I match all connexion on port 80
, and all loc1
location. So why my curl command fail ? curl command return Not found: /
...
nginx
nginx
New contributor
New contributor
New contributor
asked Apr 15 at 20:29
GAUTHIERGAUTHIER
61
61
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try with other order:
server
server_name _;
root /var/www/;
index index.php index.html index.htm;
location /
try_files $uri $uri/ /index.php$is_args$args ;
This part
location /what_you_want/
proxy_pass http://192.168.154.102/;
access_log /var/log/nginx/mp_name_access.log;
error_log /var/log/nginx/mp_name_error.log;
The http{ at the beginning does not make a sense to me
New contributor
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one
– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
add a comment |
Is this your default configuration? If so, the parameter "server_name" should already be there. What strikes me is the "location" specification. This should be without "=". And with curl you specify the port, which is not necessary for http = 80.
my suggestion would be
http
server
listen 80;
location /loc1/
proxy_pass http://192.168.0.5;
Since the headers are also important for proxy_pass, I would rather follow the official example. nginx proxy_pass example
New contributor
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
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
);
);
GAUTHIER 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%2f963184%2fnginx-simple-configuration-with-proxy-pass-fail%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 with other order:
server
server_name _;
root /var/www/;
index index.php index.html index.htm;
location /
try_files $uri $uri/ /index.php$is_args$args ;
This part
location /what_you_want/
proxy_pass http://192.168.154.102/;
access_log /var/log/nginx/mp_name_access.log;
error_log /var/log/nginx/mp_name_error.log;
The http{ at the beginning does not make a sense to me
New contributor
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one
– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
add a comment |
Try with other order:
server
server_name _;
root /var/www/;
index index.php index.html index.htm;
location /
try_files $uri $uri/ /index.php$is_args$args ;
This part
location /what_you_want/
proxy_pass http://192.168.154.102/;
access_log /var/log/nginx/mp_name_access.log;
error_log /var/log/nginx/mp_name_error.log;
The http{ at the beginning does not make a sense to me
New contributor
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one
– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
add a comment |
Try with other order:
server
server_name _;
root /var/www/;
index index.php index.html index.htm;
location /
try_files $uri $uri/ /index.php$is_args$args ;
This part
location /what_you_want/
proxy_pass http://192.168.154.102/;
access_log /var/log/nginx/mp_name_access.log;
error_log /var/log/nginx/mp_name_error.log;
The http{ at the beginning does not make a sense to me
New contributor
Try with other order:
server
server_name _;
root /var/www/;
index index.php index.html index.htm;
location /
try_files $uri $uri/ /index.php$is_args$args ;
This part
location /what_you_want/
proxy_pass http://192.168.154.102/;
access_log /var/log/nginx/mp_name_access.log;
error_log /var/log/nginx/mp_name_error.log;
The http{ at the beginning does not make a sense to me
New contributor
New contributor
answered Apr 15 at 22:10
AlanmunizrdzAlanmunizrdz
262
262
New contributor
New contributor
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one
– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
add a comment |
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one
– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
Thanks for your answer. I try to supress http directive but I obtain ""server" directive is not allowed here". I am not sure to understand, what do is wrong with order ? Because I put location inside server directive, as on your example.
– GAUTHIER
Apr 16 at 6:57
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
could you provide me more information? I mean what is the file that you are trying to edit? generally should be a new file in /etc/nginx/sites-enabled/yourfile.conf I always do as the code that I sent you, and I never had a problem, thats why probably need more details :)
– Alanmunizrdz
Apr 16 at 14:36
I try to write an entire new
/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one– GAUTHIER
Apr 16 at 15:43
I try to write an entire new
/etc/nginx/nginx.conf
. My goal is to start with a very simple configuration that I will increase step by step. And to supress all configuration I don't understand I start with a new one– GAUTHIER
Apr 16 at 15:43
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
Okay I understand, I recommend you to split the nginx.conf from the virtual hosts, you always can customize the nginx.conf and the vhost separately, Check this link, there is the default nginx conf and the vhost for php, regards! [ github.com/alanmuniz/nginx-example ]
– Alanmunizrdz
Apr 16 at 18:01
add a comment |
Is this your default configuration? If so, the parameter "server_name" should already be there. What strikes me is the "location" specification. This should be without "=". And with curl you specify the port, which is not necessary for http = 80.
my suggestion would be
http
server
listen 80;
location /loc1/
proxy_pass http://192.168.0.5;
Since the headers are also important for proxy_pass, I would rather follow the official example. nginx proxy_pass example
New contributor
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
add a comment |
Is this your default configuration? If so, the parameter "server_name" should already be there. What strikes me is the "location" specification. This should be without "=". And with curl you specify the port, which is not necessary for http = 80.
my suggestion would be
http
server
listen 80;
location /loc1/
proxy_pass http://192.168.0.5;
Since the headers are also important for proxy_pass, I would rather follow the official example. nginx proxy_pass example
New contributor
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
add a comment |
Is this your default configuration? If so, the parameter "server_name" should already be there. What strikes me is the "location" specification. This should be without "=". And with curl you specify the port, which is not necessary for http = 80.
my suggestion would be
http
server
listen 80;
location /loc1/
proxy_pass http://192.168.0.5;
Since the headers are also important for proxy_pass, I would rather follow the official example. nginx proxy_pass example
New contributor
Is this your default configuration? If so, the parameter "server_name" should already be there. What strikes me is the "location" specification. This should be without "=". And with curl you specify the port, which is not necessary for http = 80.
my suggestion would be
http
server
listen 80;
location /loc1/
proxy_pass http://192.168.0.5;
Since the headers are also important for proxy_pass, I would rather follow the official example. nginx proxy_pass example
New contributor
New contributor
answered Apr 16 at 9:38
WillHohWillHoh
13
13
New contributor
New contributor
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
add a comment |
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
Thanks, I try to add "server_name _;" and "proxy_set_header Host $host;" and "proxy_set_header X-Real-IP $remote_addr;". I supress port inside curl command, but I alway obtain error. On nginx access log, there is "192.168.0.10 - - [16/Apr/2019:12:30:52 +0200] "POST /loc1 HTTP/1.1" 404 12 "-" "curl/7.58.0""
– GAUTHIER
Apr 16 at 11:08
add a comment |
GAUTHIER is a new contributor. Be nice, and check out our Code of Conduct.
GAUTHIER is a new contributor. Be nice, and check out our Code of Conduct.
GAUTHIER is a new contributor. Be nice, and check out our Code of Conduct.
GAUTHIER 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%2f963184%2fnginx-simple-configuration-with-proxy-pass-fail%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