一 : LAMP虚拟主机配置以及控制目录访问
1、基于不同端口的虚拟主机配置
[root@lamp~]# vi /etc/httpd/conf/httpd.conf
Listen 80 #设置监听不同的虚拟主机需要使用的端口
Listen 8080
Listen 8088
<Virtualhost*:80> #三个不同端口的主机
ServerName www.80.com
DocumentRoot /var/www/html/80
</Virtualhost>
<Virtualhost*:8080>
ServerName www.8080.com
DocumentRoot /var/www/html/8080
</Virtualhost>
<Virtualhost*:8088>
ServerName www.8088.com
DocumentRoot /var/www/html/8088
</Virtualhost>
[root@lamp~]# mkdir -pv /var/www/html/{80,8080,8088} #建立三个网页目录
mkdir:已创建目录 "/var/www/html/80"
mkdir:已创建目录 "/var/www/html/8080"
mkdir:已创建目录 "/var/www/html/8088"
[root@lamp~]# echo "80" > /var/www/html/80/index.html #添加网页内容
[root@lamp~]# echo "8080" > /var/www/html/8080/index.html
[root@lamp~]# echo "8088" > /var/www/html/8088/index.html
[root@lamp~]# httpd -t #运行配置文件的语法检查
SyntaxOK
[root@lamp~]# service httpd restart
查看三个监听端口
[root@lamp~]# netstat -tlnp | grep httpd
tcp 0 0 :::8080 :::* LISTEN 1285/httpd
tcp 0 0 :::80 :::* LISTEN 1285/httpd
tcp 0 0 :::8088 :::* LISTEN 1285/httpd
使用自己的IP地址,然后打开网页分别测试。
“www.61k.com。192.168.3.32
192.168.3.32:8080
192.168.3.32:8088
2、基于不同的ip地址虚拟主机配置
首先给主机附加一个ip地址,再添加两个子IP地址。
[root@lamp~]# ifconfig eth0:0 192.168.3.33 netmask 255.255.255.0 up
[root@lamp~]# ifconfig eth0:1 192.168.3.34 netmask 255.255.255.0 up
[root@lamp~]# vi /etc/httpd/conf/httpd.conf
<Virtualhost192.168.3.32:80>
ServerName www.80.com
DocumentRoot /var/www/html/80
</Virtualhost>
<Virtualhost192.168.3.33:80>
ServerName www.8080.com
DocumentRoot /var/www/html/8080
</Virtualhost>
<Virtualhost192.168.3.34:80>
ServerName www.8088.com
DocumentRoot /var/www/html/8088
</Virtualhost>
[root@lamp~]# httpd -t
SyntaxOK
[root@lamp~]# service httpd restart
3、基于域名的虚拟主机配置
NameVirtualHost192.168.3.32:80#apache2.2.xx版本需要开启此选项,而且要和下面的保持一致;2.4.x版本就不需要此项设置了
<Virtualhost192.168.3.32:80>
ServerName www.80.com
DocumentRoot /var/www/html/80
</Virtualhost>
<Virtualhost192.168.3.32:80>
ServerName www.8080.com
DocumentRoot /var/www/html/8080
</Virtualhost>
<Virtualhost192.168.3.32:80>
ServerName www.8088.com
DocumentRoot /var/www/html/8088
</Virtualhost>
[root@lamp~]# httpd -t
[root@lamp~]# service httpd restart
我们在本地hosts添加三条记录
[root@MarsLuo桌面]#vi /etc/hosts
192.168.3.32 www.80.com
192.168.3.32 www.8080.com
192.168.3.32 www.8088.com
使用浏览器测试,这三个虚拟主机如果输入ip地址来访问的话,访问的都是第一个,使用域名可以访问三个内容
4、基于身份的目录访问。
[root@lampconf.d]# vi /etc/httpd/conf/httpd.conf
<Directory"/var/www/html/80">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
AuthName"user Access"
AuthType Basic
AuthUserFile/var/www/html/htpasswd
Requirevalid-user
</Directory>
[root@lampconf.d]# htpasswd -c /var/www/html/htpasswd admin
Newpassword:
Re-typenew password:
Addingpassword for user admin
[root@lampconf.d]# service httpd restart
浏览器输入http://192.168.3.32/80
5、基于LDAP验证的目录访问
[root@lampconf.d]# vi /etc/httpd/conf/httpd.conf
<Directory"/var/www/html/8080">
DirectoryIndex index.php index.html
Order allow,deny
Allow from all
AuthName"LDAP Access"
AuthType Basic
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPURL"ldap://192.168.2.30:389/ou=People,dc=lbs,dc=com?uid" #设置LDAP地址及OU信息
Requireuser mars #只允许LDAP账户Mars访问
</Directory>
[root@lampconf.d]# service httpd restart
浏览器输入http://192.168.3.32/8080
Ubuntu13.04 安装 LAMPVsftpdWebminphpMyAdmin 服务及设置
CentOS5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12)
RedHat5.4下Web服务器架构之源码构建LAMP环境及应用PHPWind
LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP
二 : win8中mac虚拟机网络连接设置方法(图文)
win8中mac虚拟机网络连接三 : window nginx虚拟主机(多站点)配置教程
nginx 目录结构
nginx-0.8.54
│ nginx.exe //主程序
│
├─conf
│ │ fastcgi_params
│ │ koi-utf
│ │ koi-win
│ │ mime.types
│ │ nginx.conf //核心配置文件
│ │ win-utf
│ │
│ └─vhost //虚拟主机目录
│ www.uctest.conf
│ news.uctest.conf
│
├─contrib
│ │ geo2nginx.pl
│ │ README
│ │
│ └─unicode2nginx
│ koi-utf
│ unicode-to-nginx.pl
│ win-utf
│
├─docs
│ CHANGES
│ CHANGES.ru
│ LICENSE
│ OpenSSL.LICENSE
│ PCRE.LICENCE
│ README
│ zlib.LICENSE
│
├─html
│ 50x.html
│ index.html
│
├─logs
│ access.log
│ error.log
│ nginx.pid
│
└─temp
├─client_body_temp
├─fastcgi_temp
└─proxy_temp
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
include vhost/*.conf; #加载vhost目录下的虚拟主机配置文件
}
server {
listen 80;
server_name download-bj.tv0714.com; #可配置多个主机头
location / {
root d:/www/www.uctest.com; #网站文件路径
index index.htm index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Rem 提供Windows下nginx的启动,重启,关闭功能
cls
@ECHO OFF
SET NGINX_PATH=E:
SET NGINX_DIR=E:nginx-0.8.40
color 0a
TITLE Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com)
GOTO MENU
:MENU
CLS
ECHO.
ECHO. * * * * Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com) * * *
ECHO. * *
ECHO. * 1 启动Nginx *
ECHO. * *
ECHO. * 2 关闭Nginx *
ECHO. * *
ECHO. * 3 重启Nginx *
ECHO. * *
ECHO. * 4 退 出 *
ECHO. * *
ECHO. * * * * * * * * * * * * * * * * * * * * * * * *
ECHO.
ECHO.请输入选择项目的序号:
set /p ID=
IF "%id%"=="1" GOTO cmd1
IF "%id%"=="2" GOTO cmd2
IF "%id%"=="3" GOTO cmd3
IF "%id%"=="4" EXIT
PAUSE
:cmd1
ECHO.
ECHO.启动Nginx......
IF NOT EXIST %NGINX_DIR%nginx.exe ECHO %NGINX_DIR%nginx.exe不存在
%NGINX_PATH%
cd %NGINX_DIR%
IF EXIST %NGINX_DIR%nginx.exe start %NGINX_DIR%nginx.exe
ECHO.OK
PAUSE
GOTO MENU
:cmd2
ECHO.
ECHO.关闭Nginx......
taskkill /F /IM nginx.exe > nul
ECHO.OK
PAUSE
GOTO MENU
:cmd3
ECHO.
ECHO.关闭Nginx......
taskkill /F /IM nginx.exe > nul
ECHO.OK
GOTO cmd1
GOTO MENU
四 : windows7配置虚拟AP的脚本的方法介绍
windows7配置虚拟AP的脚本61阅读| 精彩专题| 最新文章| 热门文章| 苏ICP备13036349号-1