Chinaunix首页 | 论坛 | 博客
  • 博客访问: 621912
  • 博文数量: 195
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 884
  • 用 户 组: 普通用户
  • 注册时间: 2015-09-21 16:48
文章分类

全部博文(195)

文章存档

2023年(1)

2022年(3)

2021年(16)

2020年(4)

2019年(5)

2018年(10)

2017年(72)

2016年(36)

2015年(47)

我的朋友

分类: 嵌入式

2022-11-29 15:35:04

1、安装apache2
apt-get install apache2


2、将 /var/www/html中的index.html删除,将需要的文件放至该目录,即可在浏览器中看到
rm /var/www/html/index.html




3、也可以使用软链接打开其它文件夹
rm /var/www/html -rf
ln -s /home/firmware /var/www/html


4、默认端口号为  80,如果想使用其它端口,则需要修改两个文件
4.1、vim /etc/apache2/ports.conf
Listen 80  修改为  Listen 8080
4.2、vim /etc/apache2/sites-available/000-default.conf
  修改为 

    4.3、如果想使用多个端口,则ports.conf继续添加监听端口
        

点击(此处)折叠或打开

  1. # If you just change the port or add more ports here, you will likely also
  2. # have to change the VirtualHost statement in
  3. # /etc/apache2/sites-enabled/000-default.conf

  4. Listen 8080
  5. Listen 8888


  6. <IfModule ssl_module>
  7.         Listen 443
  8. </IfModule>

  9. <IfModule mod_gnutls.c>
  10.         Listen 443
  11. </IfModule>

  12. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    而000-default.conf应该先复制粘贴一份内容再将端口修改既可

点击(此处)折叠或打开

  1. <VirtualHost *:8080>
  2.         # The ServerName directive sets the request scheme, hostname and port that
  3.         # the server uses to identify itself. This is used when creating
  4.         # redirection URLs. In the context of virtual hosts, the ServerName
  5.         # specifies what hostname must appear in the request's Host: header to
  6.         # match this virtual host. For the default virtual host (this file) this
  7.         # value is not decisive as it is used as a last resort host regardless.
  8.         # However, you must set it for any further virtual host explicitly.
  9.         #ServerName www.example.com

  10.         ServerAdmin webmaster@localhost
  11.         DocumentRoot /var/www/html

  12.         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  13.         # error, crit, alert, emerg.
  14.         # It is also possible to configure the loglevel for particular
  15.         # modules, e.g.
  16.         #LogLevel info ssl:warn

  17.         ErrorLog ${APACHE_LOG_DIR}/error.log
  18.         CustomLog ${APACHE_LOG_DIR}/access.log combined

  19.         # For most configuration files from conf-available/, which are
  20.         # enabled or disabled at a global level, it is possible to
  21.         # include a line for only one particular virtual host. For example the
  22.         # following line enables the CGI configuration for this host only
  23.         # after it has been globally disabled with "a2disconf".
  24.         #Include conf-available/serve-cgi-bin.conf
  25. </VirtualHost>
  26. <VirtualHost *:8888>
  27.         # The ServerName directive sets the request scheme, hostname and port that
  28.         # the server uses to identify itself. This is used when creating
  29.         # redirection URLs. In the context of virtual hosts, the ServerName
  30.         # specifies what hostname must appear in the request's Host: header to
  31.         # match this virtual host. For the default virtual host (this file) this
  32.         # value is not decisive as it is used as a last resort host regardless.
  33.         # However, you must set it for any further virtual host explicitly.
  34.         #ServerName www.example.com

  35.         ServerAdmin webmaster@localhost
  36.         DocumentRoot /var/www/html

  37.         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  38.         # error, crit, alert, emerg.
  39.         # It is also possible to configure the loglevel for particular
  40.         # modules, e.g.
  41.         #LogLevel info ssl:warn

  42.         ErrorLog ${APACHE_LOG_DIR}/error.log
  43.         CustomLog ${APACHE_LOG_DIR}/access.log combined

  44.         # For most configuration files from conf-available/, which are
  45.         # enabled or disabled at a global level, it is possible to
  46.         # include a line for only one particular virtual host. For example the
  47.         # following line enables the CGI configuration for this host only
  48.         # after it has been globally disabled with "a2disconf".
  49.         #Include conf-available/serve-cgi-bin.conf
  50. </VirtualHost>


        5、修改默认字体编码
vim /etc/apache2/conf-enabled/charset.conf
AddDefaultCharset UTF-8

/etc/init.d/apache2 restart
阅读(706) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~