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继续添加监听端口
-
# If you just change the port or add more ports here, you will likely also
-
# have to change the VirtualHost statement in
-
# /etc/apache2/sites-enabled/000-default.conf
-
-
Listen 8080
-
Listen 8888
-
-
-
<IfModule ssl_module>
-
Listen 443
-
</IfModule>
-
-
<IfModule mod_gnutls.c>
-
Listen 443
-
</IfModule>
-
-
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
而000-default.conf应该先复制粘贴一份内容再将端口修改既可
-
<VirtualHost *:8080>
-
# The ServerName directive sets the request scheme, hostname and port that
-
# the server uses to identify itself. This is used when creating
-
# redirection URLs. In the context of virtual hosts, the ServerName
-
# specifies what hostname must appear in the request's Host: header to
-
# match this virtual host. For the default virtual host (this file) this
-
# value is not decisive as it is used as a last resort host regardless.
-
# However, you must set it for any further virtual host explicitly.
-
#ServerName www.example.com
-
-
ServerAdmin webmaster@localhost
-
DocumentRoot /var/www/html
-
-
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
-
# error, crit, alert, emerg.
-
# It is also possible to configure the loglevel for particular
-
# modules, e.g.
-
#LogLevel info ssl:warn
-
-
ErrorLog ${APACHE_LOG_DIR}/error.log
-
CustomLog ${APACHE_LOG_DIR}/access.log combined
-
-
# For most configuration files from conf-available/, which are
-
# enabled or disabled at a global level, it is possible to
-
# include a line for only one particular virtual host. For example the
-
# following line enables the CGI configuration for this host only
-
# after it has been globally disabled with "a2disconf".
-
#Include conf-available/serve-cgi-bin.conf
-
</VirtualHost>
-
<VirtualHost *:8888>
-
# The ServerName directive sets the request scheme, hostname and port that
-
# the server uses to identify itself. This is used when creating
-
# redirection URLs. In the context of virtual hosts, the ServerName
-
# specifies what hostname must appear in the request's Host: header to
-
# match this virtual host. For the default virtual host (this file) this
-
# value is not decisive as it is used as a last resort host regardless.
-
# However, you must set it for any further virtual host explicitly.
-
#ServerName www.example.com
-
-
ServerAdmin webmaster@localhost
-
DocumentRoot /var/www/html
-
-
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
-
# error, crit, alert, emerg.
-
# It is also possible to configure the loglevel for particular
-
# modules, e.g.
-
#LogLevel info ssl:warn
-
-
ErrorLog ${APACHE_LOG_DIR}/error.log
-
CustomLog ${APACHE_LOG_DIR}/access.log combined
-
-
# For most configuration files from conf-available/, which are
-
# enabled or disabled at a global level, it is possible to
-
# include a line for only one particular virtual host. For example the
-
# following line enables the CGI configuration for this host only
-
# after it has been globally disabled with "a2disconf".
-
#Include conf-available/serve-cgi-bin.conf
-
</VirtualHost>
5、修改默认字体编码
vim /etc/apache2/conf-enabled/charset.conf
AddDefaultCharset UTF-8
/etc/init.d/apache2 restart
阅读(924) | 评论(0) | 转发(0) |