linux下配置虚拟域名

linux下配置虚拟域名

1.hosts文件位置!

/etc/hosts

2.增加一行

127.0.0.1 xxxxx

3.修改apache中的vhosts

 vi /etc/httpd/extra/httpd-vhosts.conf 
<VirtualHost *:80>
    ServerAdmin 192.168.1.66/admin
    DocumentRoot "/usr/local/apache2/htdocs/tp5admin"
    ServerName 192.168.1.66
</VirtualHost>           

4.开启vhosts

Include conf/extra/httpd-vhosts.conf

422101-20171229003039225-1303006556.png

5.重启apache

service httpd restart

解决The requested URL /login was not found on this server

<Directory />
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
</Directory>

开启重写模块

LoadModule rewrite_module modules/mod_rewrite.so


本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/8139384.html,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值