LNMP測驗環境搭建(一)——各軟體的安裝
1.Nginx整合PHP
主要是要測驗Nginx與PHP之間的連通性,Nginx主要是利用它的location區塊實作動態請求和靜態請求的分別處理,當用戶是靜態的請求就跳轉到主頁檔案,動態請求的話就交給PHP軟體來處理,
1.1修改nginx組態檔(首先還是把檔案先拷貝一份,再修改)
[root@localhost ~]# cp /data/server/nginx/conf/nginx.conf /data/server/nginx/conf/nginx.conf-bak
[root@localhost ~]# vim /data/server/nginx/conf/nginx.conf
將以下內容替換原來的nginx.conf檔案內容
user www;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#靜態請求處理的location
location / {
root html;
index index.php index.html index.htm;
}
#動態請求處理的location
location ~* .*\.(php|php5)?$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
1.2檢查語法并重新啟動nginx服務
[root@localhost ~]# /data/server/nginx/sbin/nginx -t

[root@localhost ~]# /data/server/nginx/sbin/nginx -s reload

撰寫一個PHP簡單小程式測驗一下吧!
[root@localhost php]# cd /data/server/nginx/html
[root@localhost html]# echo "<?php echo '<p>你好,周杰倫</p>'; ?>" > /data/server/nginx/html/test.php
// > /data/server/nginx/html/test.php 代表重定向到此目錄下
用宿主機網頁上打開虛擬機網址,并拼接上test.php,效果如下:


2.部署iwebshop網站
前提:需要確保PHP、nginx和mysql都是在啟動的狀態下,
2.1解壓iwebshop代碼:
未完待續,,,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/275842.html
標籤:區塊鏈
上一篇:【Centos 7】【Docker】 安裝 redis
下一篇:一文讀懂為什么要挖Chia幣?
