nginx搭建虚拟主机的配置文件方法
来源:互联网 发布:h5斗牛源码网站 编辑:程序博客网 时间:2024/04/26 12:11
虚拟主机即使server所以,nginx中用一个server{。。。}来表示一个虚拟主机,n个虚拟主机所以就用n个server{。。。}
server的基本配置文件如下
server {listen 7888; ## listen for ipv4; this line is default and implied这个虚拟主机用的端口#listen [::]:80 default ipv6only=on; ## listen for ipv6root /usr/share/nginx/www;#虚拟主机对应的站点资源目录index index.html index.htm;#虚拟主机默认的入口文件# Make site accessible from http://localhost/server_name localhost;#虚拟主机绑定的域名location / {#请求根目录,默认的入口# First attempt to serve request as file, then# as directory, then fall back to index.htmltry_files $uri $uri/ /index.html;}location /doc {#虚拟目录root /usr/share;autoindex on;allow 127.0.0.1;deny all;}location /images {root /usr/share;autoindex off;}#error_page 404 /404.html;#404错误页面# redirect server error pages to the static page /50x.html##error_page 500 502 503 504 /50x.html;#5xxx错误文件#location = /50x.html {#root /usr/share/nginx/www;#}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#proxy_pass http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {#fastcgi_pass 127.0.0.1:9000;#fastcgi_index index.php;#include fastcgi_params;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#deny all;#}}
搭建一个简单的虚拟主机很简单,但是如果加上一些修改,例如负载均衡,代理,重定向,ssl,.htaccess等等可能需要好好学习一下了。官方文档,第一手的资料,还等什么
http://nginx.org/en/docs/
- nginx搭建虚拟主机的配置文件方法
- Nginx虚拟主机配置文件
- linux nginx虚拟主机配置文件内容
- nginx 配置虚拟主机的三种方法
- 生产环境下的nginx.conf配置文件(多虚拟主机)
- 生产环境下的nginx.conf配置文件(多虚拟主机)
- nginx学习笔记4 nginx的配置文件2 虚拟主机的配置
- docker映射window本地文件夹的nginx的虚拟主机配置文件vhost.nginx.conf
- Nginx的虚拟主机配置
- nginx虚拟主机的配置
- Nginx虚拟主机的配置
- 配置Nginx的虚拟主机
- nginx虚拟主机的配置
- NGINX虚拟主机的创立
- Nginx的虚拟主机配置
- nginx虚拟主机的配置
- nginx虚拟主机的配置
- nginx的虚拟主机配置
- 构造函数、拷贝构造函数的运用
- 嵌入式linux下ntfs格式的硬盘读写方法
- Linux usb_device usb_bus usb_driver的三角关系-USB Device
- Java 回调与委派机制
- sicily 1176
- nginx搭建虚拟主机的配置文件方法
- UML建模之时序图(Sequence Diagram)
- 事件查看器无法打开,提示无法完成“应用程序”上的操作,接口未知
- sed 命令基本操作举例
- 历年四级作文真题范文
- 打包Winform程序_制作windows程序安装部署包
- 网页源代码获取
- 你应该选择和使用ADO.NET Entity吗?
- 淘宝“11.11”,“12.12”全民疯抢活动之我见