在配置Nginx服务的时候,可以给不同的uri访问指向不同的位置,例如下面的配置:
server { listen 80; server_name www.xx.com; location / { root D:/www; #定义默认根目录位置(windows系统) index index.php index.html index.htm; #定义首页索引文件的名称 } location /abc { root D:/files/xx; #定义其他请求的根目录位置(windows系统) index index.php index.html index.htm; #定义首页索引文件的名称 } }
这里的默认路径没有问题,而/abc这个路径要想正常访问,在“D:/files/xx”目录下还需要有一个abc目录,否则会抛出404异常
相关推荐
nginx配置location总结及rewrite规则写法
location 中root所指向的html是一个相对路径,相对的是这个配置文件的路径,假设此配置文件的位置是/etc/nginx/conf.d,那么这个html的绝对路径就是/etc/nginx/conf.d/html。因此为避免出现不必要的麻烦,在配置root...
Nginx配置多个service 多个访问路径 找到conf/nginx.conf修改配置文件 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid ...
nginx中location的误区,以及root和alias的配置对URL的影响和举例
Nginx配置文件 nginx.conf 详解doc文档
nginx配置+https
网络上很难找到非常详细的...本文档通过真实的实践经验,从安装OpenSSL和Nginx,到利用openssl生成证书,配置nginx的https(包括配置http请求转发到https)等,详细总结出nginx配置https的步骤,最终能帮助你配置成功。
nginx配置 nginx配置文件参考 nginx配置文件参考
nginx配置 +负载均衡+https协议 完整的配置以及nginx 启动 停止 重新加载
root和alias都可以定义在location模块中,都是用来指定请求资源的真实路径,比如: location /i/ { root /data/w3; } 请求 http://foofish.net/i/top.gif 这个地址时,那么在服务器里面对应的真正的资源是 /data/...
nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件
在Nginx的主配置文件中的http,service或者location标签中,写入配置信息,如:“deny all”。 重启nginx 在终端中输入“service nginx restart”,重启服务。 4.查看结果 我们在步骤二中输入的命令是禁止所有ip访问...
nginx 配置跨域不生效 如下配置 server { listen 80; server_name localhost; # 接口转发 location /api/ { # 允许请求地址跨域 * 做为通配符 add_header 'Access-Control-Allow-Origin' '*'; # 设置请求...
nginx配置图片服务器
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户 user www-data; #启动进程,通常设置成和cpu的数量相等 worker_processes 1; #全局错误日志及PID文件 error_log /var/log/...
本文详细讲述了Nginx location正则写法,Nginx 的Rewrite规则以及Nginx.conf中if指令与全局变量
nginx配置多个conf。nginx.conf和conf.d,
Nginx配置文件原始版本,这是刚下来的Nginx服务器最原始的版本内容,下载覆盖即可。
Nginx完整配置说明,入门级的,高级指令不在这,得自己买书看,别下错了,基本部署用的