前言
對(duì)于新手的一點(diǎn)建議:
最好熟悉一下linux 的基本命令,vim的常用命令 千萬不要無腦復(fù)制,先看一下命令,特別是路徑要注意 學(xué)會(huì)排查錯(cuò)誤本篇安裝的軟件版本為:
Linux:Centos6.8 Nginx:1.10.3 MySQL:5.7.17 PHP:7.0.16最近研究了Linux系統(tǒng)下的PHP環(huán)境搭建,個(gè)人感覺最好最好不要用yum默認(rèn)的程序包安裝,因?yàn)榘姹径急容^低,下載最新的穩(wěn)定版自行安裝比較好。現(xiàn)在網(wǎng)上教程很多,之所以還記這篇,原因有一點(diǎn),當(dāng)你重復(fù)網(wǎng)上的教程自行安裝時(shí),90%還是會(huì)出現(xiàn)各種各樣的問題,因?yàn)槟憧赡躭inux的系統(tǒng)版本不同,你想裝的軟件版本不同,安裝的方法不同,你下錯(cuò)了安裝包的版本,還有其它亂七八糟的。舉個(gè)例,比如你看著5.6的mysql安裝教程,裝5.7的,你感覺沒問題,但是事實(shí)就是,5.7的不一樣了!而且網(wǎng)上還沒有新的這方面內(nèi)容,不好找,這就需要你去摸索了,親身經(jīng)歷啊。這里面,Niginx感覺最好配,MySQL最坑。
一 準(zhǔn)備工作
1. 關(guān)閉SELINUX
修改配置文件,重啟服務(wù)后永久生效。
# sed -i ‘s/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
命令行設(shè)置立即生效。
# setenforce 0
2. 如果是阿里云ECS用戶,安全組設(shè)置中開啟80端口方便調(diào)試。
二 安裝Nginx
1. 下載源碼包
上Nginx官網(wǎng),復(fù)制最新穩(wěn)定版的下載地址過來,然后用wget下載(接下來需要下載安裝包的都可以用wget):
# cd /usr/local/src# wget http://nginx.org/download/nginx-1.10.3.tar.gz
下載完成的狀態(tài)基本都是以下這樣的:
2. 進(jìn)行解壓編譯
# tar xvf nginx-1.10.3.tar.gz# yum groupinstall “Development tools”# yum -y install gcc wget gcc-c++ automake autoconf libtool libxml2-devel libxslt-devel perl-devel perl-ExtUtils-Embed pcre-devel openssl-devel
執(zhí)行完成。
進(jìn)入解壓后的nginx-1.10.3文件夾:
cd /usr/local/src/nginx-1.10.3
執(zhí)行以下語句:
./configure /--prefix=/usr/local/nginx /--sbin-path=/usr/sbin/nginx /--conf-path=/etc/nginx/nginx.conf /--error-log-path=/var/log/nginx/error.log /--http-log-path=/var/log/nginx/access.log /--pid-path=/var/run/nginx.pid /--lock-path=/var/run/nginx.lock /--http-client-body-temp-path=/var/tmp/nginx/client /--http-proxy-temp-path=/var/tmp/nginx/proxy /--http-fastcgi-temp-path=/var/tmp/nginx/fcgi /--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi /--http-scgi-temp-path=/var/tmp/nginx/scgi /--user=nginx /--group=nginx /--with-pcre /--with-http_v2_module /--with-http_ssl_module /--with-http_realip_module /--with-http_addition_module /--with-http_sub_module /--with-http_dav_module /--with-http_flv_module /--with-http_mp4_module /--with-http_gunzip_module /--with-http_gzip_static_module /--with-http_random_index_module /--with-http_secure_link_module /--with-http_stub_status_module /--with-http_auth_request_module /--with-mail /--with-mail_ssl_module /--with-file-aio /--with-ipv6 /--with-http_v2_module /--with-threads /--with-stream /--with-stream_ssl_module
新聞熱點(diǎn)
疑難解答
圖片精選