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,如需转载请自行联系原作者
相关实践学习
基于函数计算快速搭建Hexo博客系统
本场景介绍如何使用阿里云函数计算服务命令行工具快速搭建一个Hexo博客。
相关文章
|
3天前
|
消息中间件 安全 Linux
服务器(Linux)在线下载activeMQ以及配置打开
服务器(Linux)在线下载activeMQ以及配置打开
14 3
|
3天前
|
Ubuntu Linux 编译器
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
【Linux】详解动静态库的制作和使用&&动静态库在系统中的配置步骤
|
3天前
|
缓存 网络安全 开发工具
【尝试】域名验证:配置github二级目录下的txt文件
【尝试】域名验证:配置github二级目录下的txt文件
14 2
|
3天前
|
网络协议
hexo博客6:自定义域名 购买、配置、更新部署
hexo博客6:自定义域名 购买、配置、更新部署
16 3
|
3天前
|
Unix Shell Linux
在 Linux 上把 Vim 配置为默认编辑器
在 Linux 上把 Vim 配置为默认编辑器
|
3天前
|
存储 Web App开发 Ubuntu
整理16款适用于较旧低配置电脑的最佳Linux发行版
在本指南中,趣云笔记(https://www.ecscoupon.com/)介绍了一些最好的Linux发行版,你可以将它们安装在旧PC上并为其注入新的活力。
42 0
|
3天前
|
Linux 数据安全/隐私保护
Linux 读写权限的配置
Linux 读写权限的配置
13 0
|
3天前
|
域名解析 存储 缓存
Linux中搭建DNS 域名解析服务器(详细版)
Linux中搭建DNS 域名解析服务器(详细版)
|
3天前
|
安全 Linux 网络安全
Linux _ apache服务器部署 不同域名—访问不同网站(多网站)
Linux _ apache服务器部署 不同域名—访问不同网站(多网站)
|
3天前
|
Web App开发 安全 Unix
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)