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

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
posted @ 2017-12-29 00:34  TBHacker  阅读(5538)  评论(0编辑  收藏  举报