前言
對于新手的一點建議:
最好熟悉一下linux 的基本命令,vim的常用命令 千萬不要無腦復制,先看一下命令,特別是路徑要注意 學會排查錯誤本篇安裝的軟件版本為:
Linux:Centos6.8 Nginx:1.10.3 MySQL:5.7.17 PHP:7.0.16最近研究了Linux系統下的PHP環境搭建,個人感覺最好最好不要用yum默認的程序包安裝,因為版本都比較低,下載最新的穩定版自行安裝比較好。現在網上教程很多,之所以還記這篇,原因有一點,當你重復網上的教程自行安裝時,90%還是會出現各種各樣的問題,因為你可能linux的系統版本不同,你想裝的軟件版本不同,安裝的方法不同,你下錯了安裝包的版本,還有其它亂七八糟的。舉個例,比如你看著5.6的mysql安裝教程,裝5.7的,你感覺沒問題,但是事實就是,5.7的不一樣了!而且網上還沒有新的這方面內容,不好找,這就需要你去摸索了,親身經歷啊。這里面,Niginx感覺最好配,MySQL最坑。
一 準備工作
1. 關閉SELINUX
修改配置文件,重啟服務后永久生效。
# sed -i ‘s/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
命令行設置立即生效。
# setenforce 0
2. 如果是阿里云ECS用戶,安全組設置中開啟80端口方便調試。
二 安裝Nginx
1. 下載源碼包
上Nginx官網,復制最新穩定版的下載地址過來,然后用wget下載(接下來需要下載安裝包的都可以用wget):
# cd /usr/local/src# wget http://nginx.org/download/nginx-1.10.3.tar.gz
下載完成的狀態基本都是以下這樣的:
2. 進行解壓編譯
# 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
執行完成。
進入解壓后的nginx-1.10.3文件夾:
cd /usr/local/src/nginx-1.10.3
執行以下語句:
./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
新聞熱點
疑難解答
圖片精選