M
M
Mikha Pankratov2016-09-21 16:08:54
linux
Mikha Pankratov, 2016-09-21 16:08:54

How to configure a host to open at 127.0.0.1?

Good afternoon, the
host of norms opens only by its name, but I need it to open also by
127.0.


server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name xxx;
root '/home/mmm/xxx/frontend/web/';
index index.php;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}

Thank you all, at 127.0.0.1 the "Browse Files" window opens, by the
way, when setting up the default host on localhost/127.0.0.1, I used the same config as in the tutorial)

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_namelocalhost;
location / {
try_files $uri $uri/ =404;
}
}

and noticed something else - 127.0.0.1/? then welcome nginx appears - Without ? not like

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RuMsg, 2017-09-26
@RuMsg

server_name xxx 127.0.0.1 localhost;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question