搭建了ngix-1.15.3
参考操作流程:https://www.cnblogs.com/piscesLoveCc/p/5794926.html
conf/nginx.conf下
在server中,配舍自己搭建的域名
server{
…
listen 80; //监听端口号,互联网的默认端口是80
server_name xxxx.com ; //自己的域名
root /xxx/xxx/xxx ; //定义文件放置的路径
…
}
从官方文档中,获取的代码示例:
location = / {
[ configuration A ]
}
location / {
[ configuration B ]
}
location /documents/ {
[ configuration C ]
}
location ^~ /images/ {
[ configuration D ]
}
location ~* \.(gif|jpg|jpeg)$ {
[ configuration E ]
}
The “/” request will match configuration A, the “/index.html” request will match configuration B, the “/documents/document.html” request will match configuration C, the “/images/1.gif” request will match configuration D, and the “/documents/1.jpg” request will match configuration E.
Location接受两个参数,一个字符串或者正则和一段代码。
参考文献:https://www.cnblogs.com/jenkin1991/p/8301983.html
参考文献:http://nginx.org/en/docs/http/ngx_http_core_module.html#listen