Apache HTTP Server:Apache HTTP Server是一款流行的开源Web服务器,支持在远程服务器上添加虚拟目录。
Microsoft IIS:Microsoft IIS是微软提供的Web服务器,也支持在远程服务器上添加虚拟目录。
Nginx:Nginx是一款轻量级的Web服务器,也可以在远程服务器上添加虚拟目录。
虚拟目录是指在Web服务器上设置的一个虚拟路径,指向实际存储文件的目录。
nginx在windows下的配置和linux下的配置几乎没有什么区别。如果说去别的话,就是在配置路径的时候有区别。linux下的路径配置为/home/xx/xx而windows下必须为:d:\xxx\xxx。
例如,我再windows下搭建的nginx的虚拟主机中的配置为:
server {listen 8080
server_name localhost
location / {
root html
index index.html index.htm
}
location ~ \.htm {
root D:\webroot\tpl\html
index index.html index.htm
}
location ~ (css|js|img|fonts) {
root D:\webroot\css
index index.html index.htm
}
}
首先进入nginx的配置文件nginx.conf1 #相当于在http模块再添加一个server模块
2 server {
3 #监听绑定80端口
4 listen 80
5 #下面这个是域名,多个域名用空格隔开
6 server_name www.a.com bb.com
7 #本网站的根路径
8 root /绝对路径
9 #下面是默认首页
10 location / {
11 index index.html index.php
12 }
13 #下面是针对本站所有.php文件进行处理的配置
14 location ~ \.php{
15 #加载fastcgi 一种处理方式
16 include fastcgi_params
17 #fastcgi的参数 指定文件路径及参数,否则会有404或是file not find 提示
18 fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name
19 #fastcgi的服务信息 ip:端口
20 fastcgi_pass 127.0.0.1:9000
21 #fastcgi默认首页
22 fastcgi_index index.php
23 }
24 }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)