lamp配置

打造高性能計算型服務器
說明緣由:爲何打造屬於本身的計算型高性能服務器?由於別人的服務器出問題了,找不到緣由感到不爽!理由2:使用第三方的面板當然方便,但(我也不想),功能越強會開啓大量的進程,佔用大量的計算資源。
環境:centos 7 最小化安裝
一,安裝前準備
# yum install wget
# yum install vim //安裝這個就不用我說了
# yum remove seliux* //卸載selinux軟件。後期開發這個安裝機制會對後面開發有影響。因此乾脆卸了。
二,安裝apache
# yum install httpd
  # systemctl enable httpd.servcie //加入開機啓動
  # firewall-cmd --zone=public --add-port=80/tcp --permanent //防火牆打開80
  # tcping [ip] [port] //使用tcping工具查看端口是否開啓(tcping當前沒有yum包。要本身找安裝包來安裝。或直接在瀏覽器輸入ip,進入apache的歡頁面。就成功了)
  # mkdir vhost-conf
  # echo "Include vhost-conf/*.conf" &>> /etc/httpd/conf/httpd.conf //包含vhost-conf目錄下的.conf後綴的配置文件。爲了便於區分,建議每一個站點作1個配置文件,如:站點test.com 能夠是test_com.conf
  在vhost-conf 新建站點test.com的配置文件:
    # vim test_com      

      <VirtualHost *:80>
        ServerName test.com
        ServerAlias test2.com www.test1.com  #多域名
        DocumentRoot /var/www/html/test
        DirectoryIndex index.html
      </VirtualHost>
      <Directory "/var/www/html/test">
        Options +Includes -Indexes
        llowOverride All
        Order Deny,Allow
        Allow from All
      </Directory>php

    
    # mkdir /var/www/html/test //在 /var/www/html/新建目錄test 網站的文件就是放置在這裏
     (若是就想將網站文件放置在/var/www/html/test/ 能夠在這在這新建一個軟連接將達到將文件放置在你想放的地方。如: #mkdir -p /www/test/&& rm -rf /var/www/html/test/ && ln -s /www/test /var/www/html/test/後面將網站文件放置在/www/test/)
  三,安裝mysql
    # 獲取官方yum包
    # character_set_server = utf8
      # systemctl restart mysqld.service //重啓
      登陸進mysql:
        mysql> show variables like '%character%'; //查看編碼格式
        mysql> status; //查看基本信息
  四,安裝php 7
    # yum -y install epel-release  //安裝epel倉庫
    # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm //更新yum包

    # 基礎wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm //rpm -Uvh mysql57-community-release-el7-10.noarch.rpm //更新rpm包
    #
yum install -y mysql-community-server //安裝msyql
    # systemctl start msyqld.service //啓動
    # firewall-cmd --zone=public --add-port=3360/tcp --permanent //啓用3306端口
    # systemctl resart firewalld.servcie //重啓防火牆
    # firewall-cmd --zone=public --list-ports //查看3306端口是啓用 
    #
grep 'temporary password' /var/log/mysqld.log //這種安裝方式是有密碼的,這個能夠查看臨時密碼,賬戶: root
    系統會提示你修改修改密碼:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    msyql>SET PASSWORD = PASSWORD('root'); //設置當前密碼爲root
    若是修改密碼失敗:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    修改2個全局變量:
      mysql> set global validate_password_policy=0; //修改validate_password_policy參數
      msyql>
set global validate_password_length=1; //修改密碼默認長度
    msyql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'my password' WITH GRANT OPTION; //受權遠程登陸
    mysl>
FLUSH PRIVILEGES; //刷新系統配置
    設置數據庫和服務器編碼格式:
      在 /etc/my.cnf 的mysqld 標籤下加入
      
    yum install php71w -y
    # nginx鏈接使用
    yum install php71w-fpm -y
    # 寬字節
    yum install php71w-mbstring -y
     # mysql相關
     yum install php71w-mysqlnd -y
     # redis擴展
    yum install php71w-pecl-redis -y
     # 加密使用
    yum install php71w-mcrypt -y
    # 性能加速php5.5 以上使用
    yum install php71w-opcache -y
  五,安裝vsftpd
    (這個配置有些煩,先點明目標:指定用戶指定目錄!)
    # yum install
    # systemctl enable vsftpd.service //開機啓動
    # firewall-cmd --zone=public --add-port=21/tcp --permanent //開啓21端口
    # systemctl restart firewalld.service //重啓防火牆
    # vim /etc/vsftpd/vsftpd.conf //配置vsftpd.conf文件
      #禁匿名登陸
      anonymous_enable=NO
      #註釋(禁止匿名上傳)
      #anon_upload_enable=YES
      #註釋(禁止匿名修改)
      
      #anon_mkdir_write_enable=YES
      chroot_local_user=NO //名單外的賬戶禁訪問主目錄上級目錄
      chroot_list_enable=YES # 啓用名單
      chroot_list_file=/etc/vsftpd/chroot_list #禁止訪問上級目錄名單
      vim /etc/vsftpd/chroot_list //新建 chroot_list名單
        wuChuHeng #寫入名單  
    

      
      allow_writeable_chroot=YES //加入這行,在外部並執行 chmod a-w /home/user/ 寫上賬號主目錄
      tcp_wrappers=YES //被動模式,真實原理不清,實測這樣訪問速度更快
pasv_enable=YES
      pasv_min_port=30000
 pasv_max_port=30999
     #
firewall-cmd --zone=public --add-port=30000-30999/tcp --permanent //開啓端口
     # firewall-cmd --reload
     # systemctl restart vsftpd.service //重啓
    # useradd wuChuHeng -s /sbin/nologin //添加只能登陸ftp服務的用戶    # passwd wuChuHeng //修改密碼   (配置到當前已經能夠使用賬號密碼21端口登陸在用戶主目錄了,若是想訪問主目錄上級,就將賬號一行一個加入chroot_list文件中)     # useradd -d /www/web/ -g ftp -s /sbin/nologin flash 指定目錄指定用戶    #passwd falsh     並將flash加入chroot_list,就能夠限制在它的主目錄中了。    總結:最終實現的結果是,加入chroot_lis 名單,能夠指定用戶主目錄,並限制在目錄中,不在chroot_list名單中則沒有這限制。
相關文章
相關標籤/搜索