导航:首页 > IDC知识 > 域名跳转到另一个域名apache

域名跳转到另一个域名apache

发布时间:2020-10-24 14:32:18

1、如何设置Apache通过域名访问我的应用?已经有了域名

1

2、Apache如何实现顶级域名跳转到www子域名

?

3、apache解析两个域名访问同一个项目的不同页面

ServerName 你第一个域名RewriteEngine OnRewriteRule index.htm 你第一个需要访问的页面</VirtualHost<VirtualHost *:80DocumentRoot "你网站存放的路径"ServerName 你第二个域名RewriteEngine OnRewriteRule index2.htm 你第二个需要访问的页面

4、求助,Apache上放多个域名却自动跳转到同一个网站

echo "NameVirtualHost *:80">>/etc/httpd/conf/httpd.conf
/etc/init.d/httpd restart

5、apache 404 错误可以根据域名来跳转

修改httpd.conf对虚拟主机的目录打开
AllowOverride All
然后在目录里放一个.htaccess
配置errorDocument 404 /errror.html(error.html 必须大于512B,否则apache忽略)

6、如何配置apache使不同域名转到不同端口

在Apache官网下载最新版本的Apache软件,并上传到服务器中文件夹下。

2
解压缩Apache的压缩包到本地。
命令:tar -zxvf httpd-2.4.25.tar.gz

3
输入命令:cd httpd-2.4.25,进入解压好的安装包内

4
输入: ./configure
这是对对即将安装的进行配置。

5
如果出现
checking for APR... no
configure: error: APR not found. Please read the documentation.
报错说明你的服务器中没有安装APR。下面就重新安装APR。

6
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
在命令行中依次输入以上命令下载安装包。

7
输入命令:tar -zxvf apr-1.4.5.tar.gz
解压安装包。

8
依次输入命令:
cd apr-1.4.5
./configure --prefix=/usr/local/apr

9
输入:
make && make install
进行安装

10
回到apr-util-1.3.12.tar.gz所在的目录后
输入:tar -zxvf apr-util-1.3.12.tar.gz
解压安装文件

11
输入:
cd apr-util-1.3.12
./configure --with-apr=/usr/local/apr

12
输入:make && make install
进行安装软件

13
回到pcre-8.10.zip所在的文件夹下
输入:unzip -o pcre-8.10.zip
进行解压

依次输入:
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make && make install

如果此时出现如下错误时
make[1]:***[pcrecpp.lo]错误1
make[1]:Leaving directory /data/soft/nginx/pcre-8.30
make:***[all]错误2
就输入一下代码安装C++即可
yum -y install gcc-c++

然后进入Apache压缩包的所在目录
依次输入:
cd httpd-2.4.25
./configure

输入:
make && make install

进行安装apache软件

cd /usr/local/apache2/bin/
./apachectl start
启动apache

当出现

AH00558: httpd: Could not reliably determine the server'sfully qualified domain name, using localhost.localdomain. Set the 'ServerName'directive globally to suppress this message

Starting httpd: httpd: apr_sockaddr_info_get() failed forMYHOST
先将apache服务停止,在/usr/local/apache2/bin/下 ./apachectl stop

然后切换到配置文件目录
cd ../conf
将httpd.conf备份一下(防止写错造成不可恢复的错误)
cp httpd.conf /usr/local/apache2/conf/httpCopy.conf
备份完后就可以编辑该配置文件了(如果你觉得你不会搞错什么的,可以不备份)

找到ServerRoot "/usr/local/apache2"
在下面添加
ServerName localhost:80(不修改也是可以的,只是启动的时候会出现以上的警告,看着烦,实际不会有啥影响)

cd ../bin
启动apache
./apachectl start

访问页面
http://服务器ip地址/
当出现下面的界面,则标识apache服务器安装成功

与域名跳转到另一个域名apache相关的知识