- 安裝mysql
yum -y install mysql
yum -y install mysql-devel
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
service mysqld restart - 安裝nginx
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget https://nginx.org/download/nginx-1.12.1.tar.gz
tar -zxvf nginx-1.12.1.tar.gz
cd nginx-1.12.1
./configure
make & make install
啟動(dòng)nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop 此方式停止步驟是待nginx進(jìn)程處理任務(wù)完畢進(jìn)行停止粘秆。
./nginx -s quit 此方式相當(dāng)于先查出nginx進(jìn)程id再使用kill命令強(qiáng)制殺掉進(jìn)程如迟。
./nginx -s reload
當(dāng) ngin x的配置文件 nginx.conf 修改后,要想讓配置生效需要重啟 nginx攻走,使用-s reload不用先停止 ngin x再啟動(dòng) nginx 即可將配置信息在 nginx 中生效殷勘,如下:
3.安裝composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer - 【問題】虛擬機(jī)VMVare中啟動(dòng)nginx,本地可以ping通但是無法訪問昔搂?
CentOS 7.0默認(rèn)使用的是firewall作為防火墻玲销,這里改為iptables防火墻-
關(guān)閉firewall:
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall開機(jī)啟動(dòng) firewall-cmd --state #查看默認(rèn)防火墻狀態(tài)(關(guān)閉后顯示notrunning,開啟后顯示running)
-
改用iptable
yum install iptables-services mv iptables iptables-old systemctl restart iptables.service systemctl enable iptables.service vim /etc/sysconfig/iptables //add -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-
- 【問題】創(chuàng)建nginx服務(wù)摘符,以及開機(jī)自動(dòng)啟動(dòng)nginx
-
vim /usr/lib/systemd/system/nginx.service
[Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
修改權(quán)限
chmod 754 nginx.service
開機(jī)啟動(dòng)
systemctl enable nginx.service
查看系統(tǒng)日志
journalctl -f -u nginx.service
-
【問題】
-
提示
access denied
[root@localhost system]# systemctl enable nginx.service Failed to execute operation: Access denied
【解決】執(zhí)行
systemctl daemon-reexec
centos7 在init.d中創(chuàng)建nginx腳本贤斜,執(zhí)行
service start nginx
時(shí)策吠,腳本沒有退出,ctrl+c發(fā)現(xiàn)nginx啟動(dòng)成功瘩绒,但是service stop nginx
發(fā)現(xiàn)nginx沒有停止
【解決】CentOS 7.x開始猴抹,CentOS開始使用systemd服務(wù)來代替daemon,原來管理系統(tǒng)啟動(dòng)和管理系統(tǒng)服務(wù)的相關(guān)命令全部由systemctl命令來代替锁荔。
-
-
關(guān)于systemmd 參考centos7中systemctl的使用
如上蟀给,CentOS 7.x開始,CentOS開始使用systemd服務(wù)來代替daemon阳堕,原來管理系統(tǒng)啟動(dòng)和管理系統(tǒng)服務(wù)的相關(guān)命令全部由systemctl命令來代替跋理。- 與service對(duì)比
systemctl start [unit type] <==> service [服務(wù)] start
systemctl stop [unit type] <==> service [服務(wù)] stop
systemctl restart [unit type] <==> service [服務(wù)] restart - systemctl 還有兩個(gè)自己的命令參數(shù)
systemctl reload [unit type]:重新加載服務(wù),加載更新后的配置文件(并不是所有服務(wù)都支持這個(gè)參數(shù)恬总,比如network.service)
systemctl status [unit type]:參數(shù)來查看服務(wù)運(yùn)行情況 - 原來的chkconfig 命令與 systemctl 命令對(duì)比
chkconfig [服務(wù)] on <==> systemctl enable [unit type] 設(shè)置服務(wù)開機(jī)啟動(dòng)
chkconfig [服務(wù)] off <==> systemctl disable [unit type] 設(shè)備服務(wù)禁止開機(jī)啟動(dòng)
- 與service對(duì)比
-
CentOS搭建PHP/Nginx/Mysql環(huán)境
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門目木,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人懊渡,你說我怎么就攤上這事刽射。” “怎么了剃执?”我有些...
- 文/不壞的土叔 我叫張陵誓禁,是天一觀的道長。 經(jīng)常有香客問我肾档,道長摹恰,這世上最難降的妖魔是什么? 我笑而不...
- 正文 為了忘掉前任怒见,我火速辦了婚禮俗慈,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘遣耍。我一直安慰自己闺阱,他們只是感情好,可當(dāng)我...
- 文/花漫 我一把揭開白布舵变。 她就那樣靜靜地躺著酣溃,像睡著了一般瘦穆。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上赊豌,一...
- 文/蒼蘭香墨 我猛地睜開眼拢切,長吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼蒂萎!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起淮椰,我...
- 序言:老撾萬榮一對(duì)情侶失蹤五慈,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后主穗,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體泻拦,經(jīng)...
- 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
- 正文 我和宋清朗相戀三年忽媒,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了争拐。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
- 正文 年R本政府宣布,位于F島的核電站奥邮,受9級(jí)特大地震影響万牺,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜漠烧,卻給世界環(huán)境...
- 文/蒙蒙 一杏愤、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧已脓,春花似錦珊楼、人聲如沸。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽画舌。三九已至,卻和暖如春已慢,著一層夾襖步出監(jiān)牢的瞬間曲聂,已是汗流浹背。 一陣腳步聲響...
- 正文 我出身青樓膜楷,卻偏偏與公主長得像旭咽,于是被迫代替她去往敵國和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子赌厅,可洞房花燭夜當(dāng)晚...
推薦閱讀更多精彩內(nèi)容
- 本來這篇文章是作為自己私有記錄的穷绵,所以也沒有MarkDown(主要是不怎么寫博客,也不熟悉)特愿。稍微修改一下就發(fā)上來...
- 配置systemctl命令tab自動(dòng)補(bǔ)全 系統(tǒng)版本[root@test ~]# uname -r3.10.0-22...
- CentOS 7.x開始仲墨,CentOS開始使用systemd服務(wù)來代替daemon,原來管理系統(tǒng)啟動(dòng)和管理系統(tǒng)服務(wù)...
- http://www.cnblogs.com/vicowong/p/4158113.html更換了部分包位置 揍障,僅...