A
A
Alexander Egoshin2020-07-12 13:43:47
Nginx
Alexander Egoshin, 2020-07-12 13:43:47

How to bind a domain name to an ip address in nginx?

I'm trying to bind a domain name to an ip in nginx. It does not work. At the same time, localhost from nginx works fine. I am loading nginx as administrator. What could be the problem.?
in nginx.cohf:
server {
listen 80;
server_name nenfy.com;
root C:/My_site;
index index.html index.php;
access_log C:/nginx/logs;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}

In hosts:
127.0.0.1 nenfy.com
127.0.0.1 www.nenfy.com

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Murzinov, 2020-07-12
@avers-pravo

You need to make sure that nginx listens to the interface you need, in this case it is localhost.
Replace
listen 80;
with
listen 127.0.0.1:80;

A
Alexander Egoshin, 2020-07-12
@avers-pravo

Error
2020/07/12 21:39:53 [emerg] 7248#14284: bind() to 127.0.0.0:80 failed (10049: The requested address is not valid in its context)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question