一.apache:
1).安裝httpd yum install httpd -y
2). httpd 常用命令
apache 2.4
/bin/systemctl stop httpd.service 停止服務
/bin/systemctl start httpd.service 啓動apache
/bin/systemctl restart httpd.service
apache 2.2
service httpd status 查看apache啓動狀態
service httpd start
service httpd stop
service httpd restart
3).啓動apache遇到錯誤:httpd: Could not reliably determine the server's fully qualified domain name...
解決方法:vim /etc/httpd/conf/httpd.conf 修改serverName localhost:80
服務終於啓動了,我們的apache的默認發佈目錄是:/var/www/html,默認的發佈文件是那個目錄地下的index.html.
瀏覽器訪問不了,但是apache服務已經開了,那就要考慮防火牆的問題了。
service iptables stop (關閉防火牆)
4).更改apache的默認目錄
1).DocumentRoot "目錄路徑"
2).<Directory "目錄路徑">
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
注意:apache2.2版本的Order allow, deny Allow from all 升級到apache2.4版本就變成了Require all granted
5)注意目錄每一級都要有可執行權限,不然會導致無法訪問錯誤。
6)在apache主目錄touch 1.php , phpinfo(); 瀏覽器訪問這個文件。會輸出php的一些信息. mod_php7
二.php
1). 安裝 yum install php -y
2). 配置php.ini
在linux系統中一般php.ini 存放位置在/etc/php.ini
配置date.timezone = 'Asia/Shanghai';
然後重啓apache服務
三. mysql:
1).安裝: yum install -y mysql-server mysql mysql-deve
(注意)下載不成功,則需要配置yum的ftp源配置。
查看安裝的版本:rpm -qi mysql-server
2).啓動:service mysqld start /etc/init.d/mysqld start
如果我們是第一次啓動mysql服務,mysql服務器首先會進行初始化的配置
當我們再次重新啓動mysql服務時,就不會提示這麼多信息了
3).配置管理員:mysqladmin -u root password 'root' // 通過該命令給root賬號設置密碼爲 root
4).登錄mysql: mysql -u root -p
5)./etc/my.cnf 這是mysql的主配置文件
/var/lib/mysql mysql數據庫的數據庫文件存放位置
6).創建數據庫 create database yest;
7)./var/log mysql數據庫的日誌輸出存放位置
我們的mysql數據庫的一些日誌輸出存放位置都是在/var/log這個目錄下
8)通過 chkconfig --list | grep mysqld 命令來查看mysql服務是不是開機自動啓動
chkconfig mysqld on 命令來將其設置成開機啓動,這樣就不用每次都去手動啓動了