nginx 配置文件说明之location之静态文件配置
http{
server \{
listen 8080; 监听的端口
server\_name loaclhost; 服务名称 / ip
location / \{ 访问路径
root lichong; 这里要特别说明 : 如果直接这样写lichong文件夹要和nginx的conf文件夹同级目录,如果不在统计目录,要配置绝对路径,例如下面server
index lichong.html;
\}
\# each server can has is's logs, "main" --> is the logs's style defines upstairs
\# access\_log logs/access.8080.log main;
\}
server \{
listen 8081;
server\_name loaclhost;
location / \{
root /data/test\_nginx; 这里说明要访问的test\_nginx.html所存放的目录没有和conf文件夹同级,要写绝对路径
index test\_nginx.html;
\}
\# each server can has it's logs
\# access\_log logs/access.8081.log main;
\}
}
还没有评论,来说两句吧...