博客
关于我
linux--服务配置
阅读量:581 次
发布时间:2019-03-11

本文共 1924 字,大约阅读时间需要 6 分钟。

Apache基础服务搭建

Apache 是一个广泛使用的开放源代码导航服务,适用于 Unix-like 服务器。以下是搭建 Apache 服务的步骤指南。

Apache 配置

  • 软件包名:httpd
  • 配置文件:/etc/httpd/conf/httpd.conf
  • 默认根目录DocumentRoot /var/www/html
  • 首页文件:index.html

LAMP 环境下搭建 BBS 论坛

搭建简单的 BBS 论坛,建议使用 LAMP 环境(Linux、Apache、MySQL、PHP)。

环境搭建步骤

  • 配置 yum 源

    确保服务器连接互联网,然后更新软件包,因为 /etc/yum.repos.d 中的源可能需要联通网络。

  • 安装相应软件包

    使用以下命令安装必要软件:

    yum install httpd mariadb mariadb-server php php-mysql
  • 启动并设置 Apache 服务

    启动 Apache 服务,并确保其开机自动启动:

    systemctl start httpdsystemctl enable httpd

    如果使用防火墙,需允许 HTTP 服务通过:

    firewall-cmd --permanent --add-service=httpfirewall-cmd --reload
  • 启动并设置 MySQL 服务密码

    启动和启用 MySQL 服务,并设置默认密码:

    systemctl start mysqlsystemctl enable mysqlmysql_secure_installation
  • 上传并安装 BBS 文件

    将 BBS 安装文件(如 Discuz_X2.5_SC_UTF8.zip)复制至默认根目录,并进行解压和调整权值:

    cp -p Discuz_X2.5_SC_UTF8.zip /var/www/html/cd /var/www/html/unzip Discuz_X2.5_SC_UTF8.zipmv upload/ bbschmod 777 bbs/ -Rsetenforce 0

    最后重启 Apache 服务:

    systemctl restart httpd
  • 访问 http://127.0.0.1/bbs 开始安装 BBS 论坛。


    仅下载 FTP 服务器搭建

    FTP 是文件传输协议,常用于上传和下载文件。

    服务端配置

    • 软件名:vsftpd
    • 配置文件:/etc/vsftpd/vsftpd.conf
    • 匿名用户默认共享目录:/var/ftp/pub

    安装步骤

  • 安装 FTP 服务:

    yum install vsftpd -y
  • 启动服务并设置防火墙:

    systemctl start vsftpdsystemctl enable vsftpdfirewall-cmd --permanent --add-service=ftpfirewall-cmd --reload
  • 配置服务文件:

    vim /etc/vsftpd/vsftpd.conf

    添加以下内容:

    anonymous 2listen 端口

    根据实际需求配置匿名用户访问权限。

  • 重新启动服务:

    systemctl restart vsftpd

  • 客户端访问

    lftp 客户端连接 FTP 服务器:

    lftp 127.0.0.1

    配置 NFS 服务

    NFS 是网络文件系统,可实现文件共享。

    服务端配置

  • 关闭防火墙:

    systemctl stop firewalldsystemctl disable firewalld
  • 安装 NFS 服务:

    yum install nfs-utils -y
  • 启动 NFS 服务:

    systemctl start nfs-serversystemctl enable nfs-server
  • 准备共享目录并配置:

    mkdir -p /shareecho "/share *( rw,anon!] > /etc/exportssystemctl restart nfs-server

  • 客户端配置

  • 挂载 NFS 服务器共享目录:

    mkdir /mnt/sharemount -t nfs 192.168.0.3:/share /mnt/share/df -hT
  • 建立永久挂载(建议):

    echo "192.168.0.3:/share /mnt/share nfs defaults 0 0" >> /etc/fstab
  • 配置访问权限:

    chmod 777 /mnt/share -Rsetenforce 0
  • 完成以上配置后,可以通过命令访问 NFS 共享目录,实现文件共享便利。

    转载地址:http://fpztz.baihongyu.com/

    你可能感兴趣的文章
    R2的版本由来
    查看>>
    PHP获取图片宽度高度、大小尺寸、图片类型、用于布局的img属性
    查看>>
    PHP获取当前时间、时间戳的各种格式写法汇总
    查看>>
    PHP获取当前页面的完整URL
    查看>>
    php获取文件夹中文件的两种方法
    查看>>
    PHP获取日期的一些方法总结
    查看>>
    R2学习记录
    查看>>
    PHP获取本周的每一天的时间
    查看>>
    php获取网页内容的三种方法
    查看>>
    R-CNN算法优化策略
    查看>>
    PHP规范PSR0和PSR4的理解
    查看>>
    php解析ipa包,获取logo
    查看>>
    php设置socket超时时间
    查看>>
    php设计模式 萨莱 pdf,PHP设计模式 建造者模式
    查看>>
    php设计模式之装饰器模式
    查看>>
    R&Python Data Science系列:数据处理(5)--字符串函数基于R(一)
    查看>>
    PHP设计模式:观察者模式
    查看>>
    php访问mysql(1)
    查看>>
    php详细学习1
    查看>>
    php语言优劣
    查看>>