Linux教程

linux搭建httpd

本文主要是介绍linux搭建httpd,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

主配置类 

[root@lxb ~]# cat /etc/httpd/conf.d/host.conf 
#ip地址访问
<VirtualHost 192.168.220.100:80>
    ServerAdmin ip/100
    DocumentRoot "/www/ip/100"
    ErrorLog "/var/log/httpd/host.com-error_log"
    CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/ip/100">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<VirtualHost 192.168.220.200:80>
    ServerAdmin ip/200
    DocumentRoot "/www/ip/200"
    ErrorLog "/var/log/httpd/host.com-error_log"
    CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/ip/200">
    AllowOverride None
    Options None
    Require all granted
</Directory>

#端口号访问
listen 800
<VirtualHost 192.168.220.234:800>
    ServerAdmin port800
    DocumentRoot "/www/port/800"
    ErrorLog "/var/log/httpd/host.com-error_log"
    CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/port/800">
    AllowOverride None
    Options None
    Require all granted
</Directory>

listen 1000
<VirtualHost 192.168.220.234:1000>
    ServerAdmin port1000
    DocumentRoot "/www/port/1000"
    ErrorLog "/var/log/httpd/host.com-error_log"
    CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/port/1000">
    AllowOverride None
    Options None
    Require all granted
</Directory>

#缓存访问
<VirtualHost 192.168.220.235>
 ServerAdmin port800
    DocumentRoot "/www/name"
    ErrorLog "/var/log/httpd/host.com-error_log"
    CustomLog "/var/log/httpd/host.com-access_log" common
</VirtualHost>
<Directory "/www/name">
    AllowOverride None
    Options None
    Require all granted
</Directory>

基于密码
[root@lxb ~]# cat /etc/httpd/conf.d/host1.conf 
listen 22222
<virtualhost 192.168.220.250:22222>
	servername zuoye
	DocumentRoot "/www/http"
	alias /mimi /www/secret
</virtualhost>

<directory "/www/http">
	AllowOverride None
  	#Options None
    	Require all granted
</directory>

<directory "/www/secret">
        authtype basic
	authname "please"
	authuserfile /mima
        Require user xiaoming
</directory>

这篇关于linux搭建httpd的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!