linux下配置虚拟域名

时间:2022-06-26 07:04:06

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

linux下配置虚拟域名

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