Setup Apache2 in Debian 9 and enable two ports for two sites

Posted 搞技术,下功夫

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Setup Apache2 in Debian 9 and enable two ports for two sites相关的知识,希望对你有一定的参考价值。

[email protected]:~# apt-get install apache2

[email protected]:~# cd /etc/apache2/

[email protected]:/etc/apache2# ls -l

total 80
-rw-r--r-- 1 root root  7224 Jun 20 15:29 apache2.conf
drwxr-xr-x 2 root root  4096 Jul  8 12:06 conf-available
drwxr-xr-x 2 root root  4096 Jul  8 12:06 conf-enabled
-rw-r--r-- 1 root root  1782 Jun 20 15:25 envvars
-rw-r--r-- 1 root root 31063 Jan 25 16:16 magic
drwxr-xr-x 2 root root 12288 Jul 11 10:05 mods-available
drwxr-xr-x 2 root root  4096 Jul 11 10:05 mods-enabled
-rw-r--r-- 1 root root   332 Jul  8 11:40 ports.conf
drwxr-xr-x 2 root root  4096 Jul 11 10:21 sites-available
drwxr-xr-x 2 root root  4096 Jul 11 10:14 sites-enabled

[email protected]:/etc/apache2# vi ports.conf


Listen 80
Listen 8080 

<IfModule ssl_module>

 

[email protected]:/etc/apache2# cd sites-enabled/

[email protected]:/etc/apache2/sites-enabled# cp 000-default.conf 001-default.conf

[email protected]:/etc/apache2/sites-enabled# vi 001-default.conf

<VirtualHost *:8080>

        DocumentRoot /var/www/mysite

[email protected]:/etc/apache2/sites-enabled# apachectl -k restart

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now, we have two site could be accessed. http://127.0.0.1,  http://127.0.0.1:8080

 

以上是关于Setup Apache2 in Debian 9 and enable two ports for two sites的主要内容,如果未能解决你的问题,请参考以下文章

在 Debian 9 中安装 php5.6 [关闭]

debian Linux下 apache2 出错,不能启动,求助各位大侠

Debian+Apache2服务器

Debian 8 apache2

Debian上的Apache2,全新安装,无法摆脱默认值

apache2.4 + php-fpm + phpmyadmin 在 debian