需求:访问同一个IP地址下的不同端口,转到不同的站点/访问不同的项目
修改Apache配置:增加端口
新增一个端口 避免占用80端口:这里测试端口为8100
防火墙开通端口(如果是阿里云后台,则需要在安全组新增端口)
查看端口是否可用,可用,则在防火墙添加这个端口:
查看端口是否占用 无内容输出,表示未被占用
lsof -i tcp:8100
查看防火墙是否开通端口 未找到 则表示未开通
firewall-cmd --permanent --list-port
防火墙开通端口 并重载防火墙 使之生效
firewall-cmd --permanent --zone=public --add-port=8100/tcp
firewall-cmd --reload
httpd.conf Apache默认的配置文件:
一般 Apache的 /etc/httpd/conf/httpd.conf 文件最后一行 ,IncludeOptional 后默认是引入 conf.d目录下的所有.conf文件,如果能搜到这一行 则不用改动,如果搜不到,就追加这一行代码 并保存:IncludeOptional对应的值为 /etc/httpd/conf.d/*.conf ,如果值不同,则以文件内的值为准
httpd.conf 文件: 基本不用动,下面代码块仅作参考
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/etc/httpd"
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the defaul

最低0.47元/天 解锁文章
3006

被折叠的 条评论
为什么被折叠?



