nginx server_name configuration
阿神
阿神 2017-05-16 17:09:38
0
3
876

My host does not have a domain name yet, what should I fill in for server_name?

阿神
阿神

闭关修行中......

reply all(3)
某草草

You can fill in the IP address. Either leave it blank or fill it in casually and let this configuration be the default.

nginx is based on server_name 匹配 HTTP 请求头的 host,去决定使用那个 server。host 的值浏览器默认填写域名。如果所有server_name都匹配不到就使用默认的server, so writing this is the most reliable:

server {
    listen      80 default_server;
}

If if if nonedefault_server默认的就是第一个server.

There is no need to distinguish when there is only one. Without a domain name, you can only create one on one portserver.

大家讲道理

Are you saying that you haven’t purchased a domain name yet? You can configure hosts to resolve to a fixed server yourself.

# localhost name resolution is handled within DNS itself.

# Server IP your_server_name

Configure vhost in Nginx to the specific parsing server file path:

server{
...
# Your server domain name
server_name your_server_name;
# Your file path
root /data/dev/..../;
...
}

为情所困

If not, you can adjust the IP first, and then you can add it when you have a domain name

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!