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博客。
相关文章
|
12天前
|
Oracle Java 关系型数据库
Linux环境安装配置JDK11
Linux环境安装配置JDK11
44 0
|
14天前
|
Linux 开发工具
Kali Linux配置阿里源
在配置Linux系统源前,建议先备份源列表。打开`/etc/apt/sources.list`,将原有官方源注释或删除,然后可以选择添加国内镜像源,如中科大、阿里云、清华大学、浙大或东软等源。确保每个源格式正确,以`deb`开头,`main non-free contrib`结尾。保存并退出(使用`:wq`或`:wq!`),之后运行`apt-get update`来下载新配置的源并验证是否成功。如果下载速度慢,可中断(`Ctrl+C`)后更换网络重试。
77 0
|
14天前
|
Ubuntu 安全 Linux
Linux(34)Rockchip RK3568 Ubuntu22.04和Debian 10上配置远程桌面工具
Linux(34)Rockchip RK3568 Ubuntu22.04和Debian 10上配置远程桌面工具
53 0
|
1天前
|
域名解析 存储 缓存
Linux中搭建DNS 域名解析服务器(详细版)
Linux中搭建DNS 域名解析服务器(详细版)
|
1天前
|
安全 Linux 网络安全
Linux _ apache服务器部署 不同域名—访问不同网站(多网站)
Linux _ apache服务器部署 不同域名—访问不同网站(多网站)
|
1天前
|
Web App开发 安全 Unix
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
Linux 配置FTP服务器 + vsftpd服务安装配置 (Good篇)
|
1天前
|
网络协议 Linux 开发工具
Linux中 /etc/sysconfig/network-scripts/ifcfg-<interface> 网络接口配置 详解 看这一篇够用
Linux中 /etc/sysconfig/network-scripts/ifcfg-<interface> 网络接口配置 详解 看这一篇够用
|
1天前
|
存储 Linux
Linux 本地yum源配置 (详简篇)
Linux 本地yum源配置 (详简篇)
|
7天前
|
存储 关系型数据库 MySQL
linux安装MySQL8.0,密码修改权限配置等常规操作详解
linux安装MySQL8.0,密码修改权限配置等常规操作详解
|
9天前
|
存储 安全 数据管理
【专栏】如何在 Rocky Linux 8 上安装和配置 Elasticsearch
【4月更文挑战第28天】本文指导在Rocky Linux 8上安装配置Elasticsearch,包括添加仓库,运行`yum install elasticsearch`进行安装,修改配置文件如`cluster.name`和`network.host`,启动服务并验证其正常运行。同时,文章提及了内存、文件描述符设置及安全配置,并列出常见问题及解决方法,帮助用户成功搭建Elasticsearch。