欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析

這篇文章主要為大家展示了“在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析”這篇文章吧。

在云縣等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站設(shè)計(jì)、做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作按需策劃設(shè)計(jì),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站設(shè)計(jì),營銷型網(wǎng)站建設(shè),外貿(mào)營銷網(wǎng)站建設(shè),云縣網(wǎng)站建設(shè)費(fèi)用合理。

因?yàn)橐鰓eb方向的測(cè)試,所以選擇了一個(gè)測(cè)試網(wǎng)站addressbook.

Nginx + php-fpm +centos7

首先我先要在chrome上打開,但是服務(wù)器站點(diǎn)部署在linux上,而chrome裝在windows上,所以選擇橋接模式。

Centos7橋接模式設(shè)置:

首先選擇 橋接模式

ip addr 獲取虛擬機(jī)ip地址

關(guān)閉虛擬機(jī)防火墻

systemctl stop firewalld.service

禁止fireware開機(jī)啟動(dòng)

systemctl disable firewalld.service

ping xxxx

剛開始啟動(dòng)nginx時(shí)一直報(bào)錯(cuò),最后發(fā)現(xiàn)是端口占用問題,解除80端口占用。

先查看80端口是否被占用,然后啟動(dòng)nginx

  • 查看所有端口占用

  • netstat -tln

  • 查看端口被哪個(gè)進(jìn)程占用

  • lsof -i:端口號(hào)

  • 殺死被占用端口

  • kill 端口號(hào)

接著啟動(dòng)nginx:

 /usr/local/nginx/sbin/nginx

檢查是否啟動(dòng)成功:

打開瀏覽器訪問此機(jī)器的 IP,如果瀏覽器出現(xiàn) Welcome to nginx! 則表示 Nginx 已經(jīng)安裝并運(yùn)行成功。

centos安裝nginx以及配置:https://www.jianshu.com/p/9a6c96ecc8b8

為了方便可以進(jìn)行配置以采用以下命令啟動(dòng):

service nginx reload    重新加載配置

service nginx start 啟動(dòng)Nginx

如果nginx啟動(dòng)失敗,就先強(qiáng)行殺死nginx進(jìn)程:

pkill nginx
但是每次要進(jìn)行到相應(yīng)的路徑來啟動(dòng)Nginx太麻煩了,這里可以在etc/init.d目錄下創(chuàng)建一個(gè)啟動(dòng)腳本,通過這個(gè)腳本來啟動(dòng)Nginx,這樣啟動(dòng)Nginx會(huì)方便很多
在etc/init.d目錄下創(chuàng)建nginx腳本
vim /etc/init.d/nginx
#!/bin/sh

#

# nginx - this script starts and stops the nginx daemin

#

# chkconfig:  - 85 15

# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \

#              proxy and IMAP/POP3 proxy server

# processname: nginx

# config:      /usr/local/nginx/conf/nginx.conf

# pidfile:    /usr/local/nginx/logs/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

lockfile=/var/lock/subsys/nginx

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

echo -n $"Starting $prog: "

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

}

restart() {

configtest || return $?

stop

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"

exit 2

esac

我們啟動(dòng)php-fpm,并設(shè)置php-fpm開機(jī)自啟

service php-fpm start

chkconfig php-fpm on

nginx配置文件地址路徑:

vim /usr/local/nginx/conf/nginx.conf

php-fpm配置

vim /etc/php-fpm.d/www.conf
[...]
listen = /var/run/php-fpm/php-fpm.sock
[...]
listen.owner = nobody
listen.group = nobody
[...]
user = nginx
group = nginx
[...]

編輯nginx配置文件:vim /etc/nginx/nginx.conf

server {
 28         listen 80;
 29         server_name _;
 30         root /usr/addressbook;
 31         index index.php index.html index.htm;
 32 
 33         location / {
 41              try_files $uri $uri/ =404;
 42         }
 43         location ~ \.php$ {
 44         try_files $uri =404;
 45         fastcgi_pass 127.0.0.1:9000;
 46         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 47         fastcgi_index index.php; include fastcgi_params;
 48         }
 49     }
 50 }

同時(shí)php-fpm配置文件也要更改:

listen =/var/run/php-fpm/php-fpm.sock
listen = 127.0.0.1:9000

重新加載:

systemctl reload php-fpm

在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析

以上是“在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

分享標(biāo)題:在centos7下部署運(yùn)行一個(gè)php項(xiàng)目的示例分析
文章轉(zhuǎn)載:http://chinadenli.net/article14/gghdde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)關(guān)鍵詞優(yōu)化網(wǎng)頁設(shè)計(jì)公司網(wǎng)站策劃動(dòng)態(tài)網(wǎng)站

廣告

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

成都定制網(wǎng)站建設(shè)