centos7如何利用yum安裝lnmp-創(chuàng)新互聯(lián)

這篇文章主要介紹centos7如何利用yum安裝lnmp,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

目前成都創(chuàng)新互聯(lián)已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)頁空間、網(wǎng)站改版維護、企業(yè)網(wǎng)站設(shè)計、榆次網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

步驟如下:

yum的安裝

yum update

yum安裝nginx

安裝nginx最新源

yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum repolist enabled | grep "nginx*"

安裝nginx

yum -y install nginx

啟動nginx

service nginx start

設(shè)置nginx服務(wù)器開機自啟動

systemctl enable nginx.service

檢查開機自動是否設(shè)置成功

systemctl list-dependencies | grep nginx

瀏覽器中輸入公網(wǎng)ip,檢測是否安裝成功

http://00.00.00.00/

使用yum安裝mysql5.7

安裝mysql源

yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum repolist enabled | grep "mysql.*-community.*"

安裝mysql

yum -y install mysql-community-server install mysql-community-devel

啟動mysql

service mysqld start

檢查mysql啟動是否正常

service mysqld status 或者 ps -ef | grep mysql

設(shè)置mysqld服務(wù)開機自啟動

systemctl enable mysqld.service

檢查mysqld開機自啟動是否設(shè)置成功

systemctl list-dependencies | grep mysqld

mysql5.7以后的爭強了安全機制, 所以使用yum安裝,啟動會系統(tǒng)會自動生成一個隨機的密碼,修改mysql密碼

查看mysql的隨機密碼

grep 'temporary password' /var/log/mysqld.log

使用查詢得到的隨機密碼在終端登錄

mysql -u root -p 更改密碼(mysql文檔規(guī)定,密碼必須包括大小寫字母數(shù)字加特殊符號>8位)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yourpassword';

退出mysql客戶端,用剛才修改的密碼登錄確保密碼修改成功

exit;
mysql -u root -p

安裝php7.1

安裝php源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

檢查源是否安裝成功

 yum repolist enabled | grep "webtatic*"

安裝php擴展源

yum -y install php71w php71w-fpm
yum -y install php71w-mbstring php71w-common php71w-gd php71w-mcrypt
yum -y install php71w-mysql php71w-xml php71w-cli php71w-devel
yum -y install php71w-pecl-memcached php71w-pecl-redis php71w-opcache

驗證php7.1.x和擴展是否安裝成功

驗證php是否安裝成功

php -v

驗證對應(yīng)的擴展是否安裝成功

php -m

設(shè)置php-fpm并檢測php-fpm的運行狀態(tài)

啟動php-fpm

service php-fpm star

檢查啟動是否成功

service php-fpm status

設(shè)置開機自啟動

systemctl enable php-fpm.service

檢查開機自啟動是否設(shè)置成功

systemctl list-dependencies | grep php-fpm
ps -ef | grep php-fpm

nginx配置如下:

server{
 listen  80;
 server_name youserver;
 index index.html index.php;
 root /home/public;
 #charset koi8-r;
 #access_log logs/host.access.log main;
 location / {
  index index.html index.htm index.php;
  try_files $uri $uri/ /index.php?$query_string;
  }
 error_page 404    /404.html;
 # redirect server error pages to the static page /50x.html
 #
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
  root html;
 }
 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 #
 #location ~ .php$ {
 # proxy_pass http://127.0.0.1;
 #}
 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 location ~ .php$ {
  root   /home/public;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME /home/public$fastcgi_script_name;
  include  fastcgi_params;
}
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 location ~ /.ht {
  deny all;
 }
}

以上是“centos7如何利用yum安裝lnmp”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計公司行業(yè)資訊頻道!

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

文章標(biāo)題:centos7如何利用yum安裝lnmp-創(chuàng)新互聯(lián)
當(dāng)前網(wǎng)址:http://muchs.cn/article48/ddchep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、ChatGPT、定制開發(fā)、全網(wǎng)營銷推廣、網(wǎng)站建設(shè)、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)