第一次配置LAMP運行環境,上網查詢了不少資料,一邊試命令一邊學習。服務器重置了不少次。php
雖然有OneinStack這個方便的網站一鍵命令部署,但知道這個網站倒是我本身踩坑以後的事情了,故此記錄。html
yum -y install httpd # 設置開機啓動chkconfig --list httpd查看 chkconfig httpd on # 進入配置文件進行以下修改 vi /etc/httpd/conf/httpd.conf ServerName localhost:80 DirectoryIndexindex.html index.php index.htm service httpd restart
wget https://repo.mysql.com//mysql57-community-release-el6-9.noarch.rpm rpm mysql57-community-release-el6-9.noarch.rpm yum install mysql-community-server service mysqld start # mysql臨時密碼保存位置:/var/log/mysqld.log chkconfig mysqld on mysql -uroot -p set password for 用戶名@localhost = password('新密碼');
# 安裝依賴包 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm # 安裝PHP及相關軟件 yum install php70w.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64 php70w-fpm.x86_64 php70w-mysql.x86_64 yum install php70w-gd.x86_64 libjpeg* php70w-ldap.x86_64 php70w-odbc.x86_64 php70w-pear.noarch php70w-xml.x86_64 yum install php70w-xmlrpc.x86_64 php70w-mbstring.x86_64 php70w-bcmath.x86_64 php-mhash php70w-pecl-redis.x86_64 # 查看php-fpm whereis php-fpm # 啓動php-fpm service php-fpm start # 查看php版本 php -v
# 配置系統自帶的SSH,修改Port 22端口號 /etc/ssh/sshd_config # 重啓SSH服務 service sshd restart
# 跳轉到站點根目錄 cd /var/www/html # 下載壓縮包 wget https://files.phpmyadmin.net/phpMyAdmin/4.6.0/phpMyAdmin-4.6.0-all-languages.tar.gz # 解壓 tar zxvf phpMyAdmin-4.6.0-all-languages.tar.gz # 重命名 mv phpMyAdmin-4.6.0-all-languages.tar.gz newName service mysqld restart # 若提示丟失mysqli文件 vi /etc/php.d/mysqli.ini # 取消掉「;Enable mysqli extension module」前的分號 # 查看已安裝軟件,如 rpm -qa | grep mysql*
# 打開Apache配置文件 vi /etc/httpd/conf/httpd.conf # 去掉「#LoadModule rewrite_module modules/mod_rewrite.so」前面的「#」 # 在httpd.conf文件最後加上 #Open 301Rewrite RewriteEngine on #Log level RewriteLogLevel 0 #Log address RewriteLog logs/rewrite.log #main code rewritecond %{HTTP_HOST} ^straystarry.com$ rewriterule ^(.+) %{HTTP_HOST}$1 [C] rewriterule ^straystarry.com(.*) https://www.straystarry.com$1