欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Ubuntu Server 11.10安裝配置lamp(Apache+MySQL+PHP)

 更新時(shí)間:2016年10月07日 23:50:47   投稿:mdxy-dxy  
這篇文章主要介紹了Ubuntu Server 11.10安裝配置lamp(Apache+MySQL+PHP),需要的朋友可以參考下

準(zhǔn)備篇:

1、配置防火墻,開啟80端口、3306端口

說(shuō)明:Ubuntu默認(rèn)安裝是沒(méi)有開啟任何防火墻的,為了服務(wù)器的安全,建議大家安裝啟用防火墻設(shè)置,這里推薦使用iptables防火墻。
whereis iptables #查看系統(tǒng)是否安裝防火墻
iptables: /sbin/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz #表示已經(jīng)安裝iptables
apt-get install iptables #如果默認(rèn)沒(méi)有安裝,請(qǐng)運(yùn)行此命令安裝防火墻
iptables -L #查看防火墻配置信息,顯示如下:

#####################################################
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
#####################################################
nano /etc/iptables.default.rules #添加以下內(nèi)容
##################################################################################################
*filter
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allows all outbound traffic
# You could modify this to only allow certain traffic
-A OUTPUT -j ACCEPT
# Allows HTTP and MySQLconnections from anywhere (the normal ports for websites)
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 3306 -j ACCEPT
# Allows SSH connections for script kiddies
# THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT
# Now you should read up on iptables rules and consider whether ssh access
# for everyone is really desired. Most likely you will only allow access from certain IPs.
# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
# log iptables denied calls (access via 'dmesg' command)
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7
# Reject all other inbound - default deny unless explicitly allowed policy:
-A INPUT -j REJECT
-A FORWARD -j REJECT
COMMIT
##################################################################################################
ctrl+o #保存
ctrl+x #退出


備注:80是指web服務(wù)器端口、3306是指MySQL數(shù)據(jù)庫(kù)鏈接端口、22是指SSH遠(yuǎn)程管理端口
iptables-restore < /etc/iptables.default.rules #使防火墻規(guī)則生效
nano /etc/network/if-pre-up.d/iptables #創(chuàng)建文件,添加以下內(nèi)容,使防火墻開機(jī)啟動(dòng)
##########################################################
#!/bin/bash
/sbin/iptables-restore </etc/iptables.default.rules
##########################################################
chmod +x /etc/network/if-pre-up.d/iptables #添加執(zhí)行權(quán)限

安裝篇

一、安裝apache

apt-get install apache2 #安裝apache,根據(jù)提示輸入y安裝
service apache2 start #啟動(dòng)apache
service apache2 restart #重啟
apt-get install chkconfig #安裝chkconfig
chkconfig apache2 on #開機(jī)啟動(dòng)apache

二、安裝MySQL

apt-get install mysql-server #安裝mysql,根據(jù)提示輸入y安裝
安裝過(guò)程中,會(huì)跳出輸入root密碼的界面
輸入2次密碼,繼續(xù)自動(dòng)安裝

service mysql start #啟動(dòng)
chkconfig mysql on #開機(jī)啟動(dòng)mysql
service mysql restart #重啟

三、安裝php

1、apt-get install php5 #安裝php5,根據(jù)提示輸入y安裝
2、安裝PHP組件,使PHP支持 MySQL
apt-get install php5-mysql php5-gd libjpeg8-dev php5-imap php5-ldap php5-odbc php*-pear php*-xml php5-xmlrpc php5-mcrypt php5-mhash libmcrypt* libmcrypt-dev php-fpdf
/etc/init.d/mysql restart #重啟mysql
/etc/init.d/apache2 restart #重啟apache2
ln -s /etc/php5/apache2/php.ini /etc/php.ini #把php配置文件鏈接到系統(tǒng)默認(rèn)位置

配置篇

一、Apache配置
cp /etc/apache2/apache2.conf /etc/apache2/apache2.confbak #備份
nano /etc/apache2/apache2.conf #編輯
ServerTokens Prod #在出現(xiàn)錯(cuò)誤頁(yè)的時(shí)候不顯示服務(wù)器操作系統(tǒng)的名稱
ServerSignature Off #在在錯(cuò)誤頁(yè)中不顯示apache2的版本
MaxKeepAliveRequests 1000 #修改為1000(默認(rèn)為100,增加同時(shí)連接數(shù))
ServerName localhost   #添加apache2默認(rèn)服務(wù)名
ctrl+o #保存
ctrl+x #退出
nano /etc/apache2/sites-enabled/000-default #編輯
Options MultiViews FollowSymLinks #不在瀏覽器上顯示樹狀目錄結(jié)構(gòu)
ctrl+o #保存
ctrl+x #退出
nano /etc/apache2/mods-enabled/dir.conf   #編輯,設(shè)置默認(rèn)主頁(yè)順序
DirectoryIndex index.html  index.php  index.htm
ctrl+o #保存
ctrl+x #退出
a2enmod rewrite #激活apache2偽靜態(tài)模塊mod rewrite

二、配置php

nano /etc/php5/apache2/php.ini #編輯
date.timezone = PRC #在946行 把前面的分號(hào)去掉,改為date.timezone = PRC
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,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, posix_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
#在386行 列出PHP可以禁用的函數(shù),如果某些程序需要用到這個(gè)函數(shù),可以刪除,取消禁用。
expose_php = Off #在432行 禁止顯示php版本的信息
magic_quotes_gpc = On #在745行 打開magic_quotes_gpc來(lái)防止SQL注入
open_basedir = .:/tmp/ #在380行,設(shè)置表示允許訪問(wèn)當(dāng)前目錄(即PHP腳本文件所在之目錄)和/tmp/目錄,可以防止php木馬跨站,如果改了之后安裝程序有問(wèn)題,可注銷此行,或者直接寫上程序目錄路徑/var/www/www.osyunwei.com/:/tmp/
ctrl+o #保存
ctrl+x #退出

測(cè)試篇
cd /var/www #進(jìn)入默認(rèn)站點(diǎn)目錄
nano index.php #新建測(cè)試文件

<?php
phpinfo();
?>

ctrl+o #保存
ctrl+x #退出
chown www-data.www-data -R /var/www #添加目錄所有者
chmod 700 -R /var/www #設(shè)置目錄權(quán)限
在客戶端瀏覽器輸入服務(wù)器IP地址,可以看到相關(guān)的配置信息!

備注:

apache2默認(rèn)站點(diǎn)目錄是:/var/www
權(quán)限設(shè)置:chown www-data.www-data -R /var/www
apache2虛擬主機(jī)配置文件:/etc/apache2/sites-enabled/000-default #虛擬主機(jī)配置文件
MySQL數(shù)據(jù)庫(kù)目錄是:/var/lib/mysql
權(quán)限設(shè)置:chown mysql.mysql -R /var/lib/mysql

相關(guān)文章

  • Ubuntu下使用python3中的venv創(chuàng)建虛擬環(huán)境

    Ubuntu下使用python3中的venv創(chuàng)建虛擬環(huán)境

    這篇文章主要介紹了Ubuntu下使用python3中的venv創(chuàng)建虛擬環(huán)境,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • Linux防火墻配置SNAT教程(1)

    Linux防火墻配置SNAT教程(1)

    這篇文章主要為大家詳細(xì)介紹了Linux防火墻配置SNAT教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • Linux桌面的4種掃描工具

    Linux桌面的4種掃描工具

    今天小編就為大家分享一篇關(guān)于Linux桌面的4種掃描工具的文章,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2018-10-10
  • centos8的80端口不通問(wèn)題及解決

    centos8的80端口不通問(wèn)題及解決

    這篇文章主要介紹了centos8的80端口不通問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • linux抵御DDOS攻擊 通過(guò)iptables限制TCP連接和頻率

    linux抵御DDOS攻擊 通過(guò)iptables限制TCP連接和頻率

    這篇文章主要介紹了linux抵御DDOS攻擊 通過(guò)iptables限制TCP連接和頻率,需要的朋友可以參考下
    2016-05-05
  • 修改sshd默認(rèn)端口的步驟

    修改sshd默認(rèn)端口的步驟

    ssh的的默認(rèn)端口是22,將它修改成別的值會(huì)更安全一些,修改步驟看下面介紹
    2014-01-01
  • Apache 網(wǎng)站速度更快

    Apache 網(wǎng)站速度更快

    Apache2.0在性能上的改善最吸引人.在支持POSIX線程的Unix系統(tǒng)上,Apache可以通過(guò)不同的MPM運(yùn)行在一種多進(jìn)程與多線程相混合的模式下,增強(qiáng)部分配置的可擴(kuò)充性能.相比于Apache
    2009-07-07
  • Linux CentOS7 vim寄存器解讀

    Linux CentOS7 vim寄存器解讀

    這篇文章主要介紹了Linux CentOS7 vim寄存器使用方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • Centos8搭建配置nis域服務(wù)詳細(xì)步驟

    Centos8搭建配置nis域服務(wù)詳細(xì)步驟

    大家好,本篇文章主要講的是Centos8搭建配置nis域服務(wù)詳細(xì)步驟,感興趣的同學(xué)趕快來(lái)看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • 在Linux環(huán)境下安裝Kafka

    在Linux環(huán)境下安裝Kafka

    本文以安裝Kafka的步驟做了圖文詳細(xì)介紹,Kafka是一種高吞吐量 的分布式發(fā)布訂閱消息系統(tǒng),對(duì)Kagka感興趣的小伙伴可以參考參考本篇文章
    2021-08-08

最新評(píng)論