包含 nginx 标签的文章

修改 Nginx 附件大小的限制

Nginx 默认限制请求附件大小为 1MB。即:默认当你通过 Nginx 代理上传附件,大于 1M 的文件时,浏览器会抛出异常。 可以通过设置 nginx.conf 中的 http 块,添加或修改 client_max_body_size 参数来更改默认的附件大小限制。例如,将 client_max_body_size 设置为 8m,即可将附件大小限制更改为 8MB。这将影响到所有站点。当然也可以只修改某一个站点的配置,在站点的 server 块中添加或修改 client_max_body_size 即可。 修改后检查配置文件的语法是否正确:sudo nginx -t。如果没有显示语法错误,继续下一步;如果有错误,请检查配置文件并修复错误。 然后重新加载 Nginx 配置:sudo service nginx reload 或者 sudo systemctl reload ngi...

Nginx 的 root 与 alias 的区别

Nginx 指定文件路径有两种方式 root 和 alias,指令的使用方法和作用域: root 语法:root path 配置段:http、server、location、if alias 语法:alias path 配置段:location alias 是一个目录别名的定义,root 则是根目录(父目录)的定义。关于别名,我的理解是 alias 指定的是物理路径,location 指定的则是该物理路径的别名,一个物理路径可以存在多个别...

Ubuntu 安装 Nginx

apt-get install nginx # 安装 service nginx status # 查看服务运行状态 netstat -nap |grep nginx # 查看服务所使用的端口 网页浏览器访问服务器 IP 显示: Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com. Thank you for using nginx...