CentOS7.0搭建LAMP服務(wù)器(Apache+PHP+MariaDB)_第1頁
CentOS7.0搭建LAMP服務(wù)器(Apache+PHP+MariaDB)_第2頁
CentOS7.0搭建LAMP服務(wù)器(Apache+PHP+MariaDB)_第3頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、WORD格式準(zhǔn)備篇:專業(yè)資料整理WORD格式一、配置防火墻,開啟80 端口、3306端口專業(yè)資料整理WORD格式CentOS 7.0默認(rèn)使用的是firewall作為防火墻,這里改為iptables防火墻。專業(yè)資料整理WORD格式1、關(guān)閉firewall:專業(yè)資料整理WORD格式systemctl stop firewalld.service# 停頓firewall專業(yè)資料整理WORD格式systemctl disable firewalld.service#制止firewall開機啟動專業(yè)資料整理WORD格式2、安裝iptables防火墻專業(yè)資料整理WORD格式y(tǒng)um install ipta

2、bles-services# 安裝專業(yè)資料整理WORD格式vi /etc/sysconfig/iptables# 編輯防火墻配置文件專業(yè)資料整理WORD格式# Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended. *filter:INPUT ACCEPT 0:0 :FORWARD ACCEPT 0:0 :OUTPUT ACCEPT 0:0-A INPUT -m state -state ESTABLISHED,RELATED

3、-j ACCEPT -A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 22 -j ACCEPT專業(yè)資料整理WORD格式-A INPUT -m state -state NEW -m tcp -p tcp -dport 80 -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 3306 -j ACCEPT-A INPUT -j REJECT -reject-with icmp-hos

4、t-prohibited-A FORWARD -j REJECT -reject-with icmp-host-prohibitedCOMMIT:wq! # 保存退出systemctl restart iptables.service# 最后重啟防火墻使配置生效systemctl enable iptables.service# 設(shè)置防火墻開機啟動二、關(guān)閉SELINUXvi /etc/selinux/config專業(yè)資料整理WORD格式#SELINUX=enforcing# 注釋掉專業(yè)資料整理WORD格式#SELINUXTYPE=targeted# 注釋掉專業(yè)資料整理WORD格式SELINUX

5、=disabled# 增加:wq! # 保存退出setenforce 0#使配置立即生效安裝篇:一、安裝Apache專業(yè)資料整理WORD格式y(tǒng)um install d# 根據(jù)提示,輸入Y 安裝即可成功安裝專業(yè)資料整理WORD格式systemctl start d.service# 啟動apache專業(yè)資料整理WORD格式systemctl stop d.service#停頓apache專業(yè)資料整理WORD格式systemctl restart d.service# 重啟apache專業(yè)資料整理WORD格式systemctl enable d.service# 設(shè)置apache開機啟動專業(yè)資料整

6、理WORD格式在客戶端瀏覽器中翻開效勞器IP地址,會出現(xiàn)下面的界面,說明apache安裝成功專業(yè)資料整理WORD格式二、安裝MariaDBCentOS 7.0中,已經(jīng)使用MariaDB替代了 MySQL數(shù)據(jù)庫1、安裝 MariaDB專業(yè)資料整理WORD格式y(tǒng)um install mariadb mariadb-server#詢問是否要安裝,輸入Y 即可自動安裝,直到安裝完成專業(yè)資料整理WORD格式systemctl start mariadb.service# 啟動MariaDB專業(yè)資料整理WORD格式systemctl stop mariadb.service# 停頓MariaDB專業(yè)資料整

7、理WORD格式systemctl restart mariadb.service# 重啟MariaDB專業(yè)資料整理WORD格式systemctl enable mariadb.service# 設(shè)置開機啟動專業(yè)資料整理WORD格式cp /usr/share/mysql/my-f /etc/f# 拷貝配置文件注意:如果/etc目錄專業(yè)資料整理WORD格式下面默認(rèn)有一個f,直接覆蓋即可專業(yè)資料整理WORD格式2、為root賬戶設(shè)置密碼專業(yè)資料整理WORD格式mysql_secure_installation回車,根據(jù)提示輸入Y輸入 2 次密碼,回車根據(jù)提示一路輸入Y最后出現(xiàn): Thanks for

8、 using MySQL!MySql密碼設(shè)置完成,重新啟動MySQL :systemctl restart mariadb.service# 重啟 MariaDB三、安裝PHP專業(yè)資料整理WORD格式1、安裝 PHP專業(yè)資料整理WORD格式y(tǒng)um install php# 根據(jù)提示輸入Y 直到安裝完成2、安裝 PHP 組件,使PHP 支持MariaDByum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xmlphp-xmlrpc php-mbstring php-bcmath php-mhash# 這里選擇以

9、上安裝包進(jìn)展安裝,根據(jù)提示輸入Y 回車systemctl restart mariadb.service# 重啟 MariaDBsystemctl restart d.service# 重啟 apache配置篇一、 Apache配置vi /etc/d/conf/d.conf# 編輯文件專業(yè)資料整理WORD格式ServerSignature On# 添加,在錯誤頁中顯示Apache的版本, Off 為不顯示專業(yè)資料整理WORD格式Options Indexes FollowSymLinks# 修改為: Options Includes ExecCGIFollowSymLinks允許效勞器執(zhí)行CG

10、I 及 SSI ,制止列出目錄#AddHandler cgi-script .cgi# 修改為: AddHandler cgi-script .cgi .pl允許擴展名為.pl 的 CGI 腳本運行AllowOverride None# 修改為: AllowOverride All允許 .htaccessAddDefaultCharset UTF-8# 修改為: AddDefaultCharset GB2312添加 GB2312為默認(rèn)編碼#Options Indexes FollowSymLinks# 修改為Options FollowSymLinks不在瀏覽器上顯示樹狀目錄構(gòu)造Directo

11、ryIndex index.html# 修改為: DirectoryIndex index.html index.htmDefault.html Default.htmindex.php設(shè)置默認(rèn)首頁文件,增加index.phpMaxKeepAliveRequests 500#添加 MaxKeepAliveRequests 500增加同時連接數(shù):wq! # 保存退出systemctl restart d.service# 重啟 apacherm -f /etc/d/conf.d/welcome.conf /var/www/error/noindex.html#刪除默認(rèn)測試頁二、 php配置vi

12、/etc/php.ini# 編輯date.timezone = PRC# 把前面的分號去掉,改為date.timezone = PRCdisable_functions =passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_statu專業(yè)資料整理WORD格式s,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_s專業(yè)資料整理WORD格式ocket_server,esca

13、peshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posi

14、x_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname# 列出 PHP 可以禁用的函數(shù),如果某些程序需要用到這個函數(shù),可以刪除,取消禁用。expos

15、e_php = Off#制止顯示php版本的信息專業(yè)資料整理WORD格式short_open_tag = ON# 支持php短標(biāo)簽專業(yè)資料整理WORD格式open_basedir = .:/tmp/# 設(shè)置表示允許訪問當(dāng)前目錄(即PHP腳本文件所在之目錄)和專業(yè)資料整理WORD格式/tmp/目錄 ,可以防止php木馬跨站,如果改了之后安裝程序有問題(例如:織夢內(nèi)容管理系統(tǒng)),專業(yè)資料整理WORD格式可以注銷此行,或者直接寫上程序的目錄/data/osyunwei/:/tmp/專業(yè)資料整理WORD格式:wq! # 保存退出專業(yè)資料整理WORD格式systemctl restart mariadb.service# 重啟MariaDB專業(yè)資料整理WORD格式systemctl restart d.service# 重啟

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論