Linux(CentOS 7)+ Nginx(1.10.2)+ Mysql(5.7.16)+ PHP(7.0.12)完整環境搭建

       首先安裝Linux系統,我以虛擬機安裝來作示例,先去下載 VitualBox,這是一款開源的虛擬機軟件,https://www.virtualbox.org 官網地址。或者是VMware,www.vmware.com,不過這個軟件是收費的。固然同時還要去下載一個Linux鏡像,我下載是CentOS 7系統,https://www.centos.org/downloadphp

下載好了以後打開虛擬機,我用的是VMware,選擇建立自定義虛擬機:html

 

繼續下一步:mysql

 

點擊完成。nginx

看到這個界面後,點擊CD/DVD(IDE):c++

點擊選擇光盤鏡像,把下載好的Centos 7 系統放進去:web

 

接着回到上個頁面,點擊啓動磁盤:正則表達式

 

 選擇CD/DVD,而後點擊從新啓動:sql

 能夠看到已經載入鏡像文件,選擇第一個安裝:數據庫

 

選擇語言,繼續,vim

 

 這玩意得先點進去,而後保存下,

要上網的同志不要忘記開啓網絡了:

這個時候就開始安裝了,安裝的同時把root密碼和用戶帳號密碼設置下:

 

 設置完成後,咱們就能夠耐心的等待了……

OK,重啓系統,登陸root帳戶,也能夠登陸你本身設置好的用戶帳戶,是否是很酷炫。

先看下網絡有沒有問題,輸入ping www.baidu.com,看到網絡能夠正常訪問:

若是不能正常訪問網絡,修改ifcfg文件,把ONBOOT="no" 改成 "yes",保存便可。

 

[root@172 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736 

 

 

重啓下網絡:

systemctl restart network.service

查看ip地址,輸入ip addr,紅色部分能夠直接在瀏覽器裏訪問到,以下圖:

 

 

ok,沒有問題,接下來你就能夠安裝各類軟件了……固然,咱們先作正事,開始安裝PHP,先去PHP官網上下載壓縮包:

選擇一個版本,而後複製連接地址,在命令行輸入:

wget http://hk1.php.net/get/php-7.0.12.tar.gz/from/this/mirror

提示找不到wget命令,先下載wget:

yum install wget

安裝完成後在執行:

wget http://hk1.php.net/get/php-7.0.12.tar.gz/from/this/mirror

看到已經下載好到目錄下了:

接下來再解壓,輸入:

tar -zxvf mirror

解壓好後再進入到 http://php.net/manual/zh/install.fpm.php 來安裝php-fpm,由於如今的php還不能和nginx一塊兒工做,只能和Apache工做,php-fpm是nginx和php的一個橋樑,因此

 咱們繼續安裝php-fpm。

先安裝須要的編譯工具 gcc,gcc++,libxml2-devel:

yum install gcc gcc-c++ libxml2-devel

進入到php目錄下進行編譯和安裝:

cd php-7.0.12/  //進入php目錄下
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7 --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-pdo-mysql=/usr/local/mysql --enable-fpm --enable-libxml   //這裏選擇要安裝的php目錄,後面參數是開啓php-fpm,支持mysql等
make   //進行編譯
make install  //進行安裝

安裝完成後進入到安裝目錄下:

cd /usr/local/php7/lib/php

php安裝完成。

mysql的安裝

首先建立一個名爲mysql且沒有登陸權限的用戶和一個名爲mysql的用戶組:

groupadd -r mysql && useradd -r -g mysql -s /bin/false -M mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16.tar.gz

安裝mysql須要的編譯工具:

yum -y install cmake gcc-c++ ncurses-devel perl-Data-Dumper boost boost-doc boost-devel

進入到mysql目錄下進行編譯和安裝:

cd /mysql-5.7.16
cmake -DCMAKE_STALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mydata/mysql/data -DSYSCONFDIR=/etc -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1  -DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock  -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DENABLED_DOWNLOADS=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DMYSQL_MAINTAINER_MODE=0 -DWITH_SSL:STRING=bundled -DWITH_ZLIB:STRING=bundled 

 

 執行上面的配置命令的結果以下圖所示:

 

 

測試發現編譯MySQL5.7以及更高的版本時,都須要下載並引用或者直接安裝boost庫,不然在執行cmake命令時會報以下錯誤:

 

-- Running cmake version 2.8.11
-- Configuring with MAX_INDEXES = 64U
-- SIZEOF_VOIDP 8
-- MySQL 5.7.16 [MySQL版本] -- Packaging as: mysql-5.7.16-Linux-x86_64 -- Looked for boost/version.hpp in and -- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND -- LOCAL_BOOST_DIR -- LOCAL_BOOST_ZIP -- Could not find (the correct version of) boost. [關鍵錯誤信息] -- MySQL currently requires boost_1_59_0 [解決辦法] CMake Error at cmake/boost.cmake:76 (MESSAGE): [具體錯誤和解決方法] You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> This CMake script will look for boost in <directory>.  If it is not there, it will download and unpack it (in that directory) for you. If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80
 Call Stack (most recent call first): cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST) CMakeLists.txt:452 (INCLUDE) -- Configuring incomplete, errors occurred! See also "/mydata/mysql-5.7.16/CMakeFiles/CMakeOutput.log".

只要將http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz下載下來,上傳到/usr/local/boost,在執行命令:

cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
編譯和安裝:
make && make install

 

 查看編譯成功後的MySQL安裝目錄:

使用cd命令查看MySQL的安裝目錄/usr/local/mysql/下面是否生成了相關目錄文件(最重要的固然是bin、sbin和lib目錄)。若是lib目錄下面沒有生成如圖所示的.so動態庫文件和.a靜態庫文件,那麼說明安裝不成功,須要從新編譯安裝。(即便成功了也可能會致使php進程沒法找到mysql的相關庫文件)。

而後把編譯生成的my.cnf文件備份:

cp /etc/my.cnf /etc/my.cnf.bak

再修改my.cnf配置以下圖:(具體路徑根據你安裝的目錄爲準)

# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [client] port=3306 socket=/var/run/mysql/mysql.sock [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. user = mysql basedir = /usr/local/mysql datadir = /mydata/mysql/data port=3306 server-id = 1 socket=/var/run/mysql/mysql.sock character-set-server = utf8 log-error = /var/log/mysql/error.log pid-file = /var/log/mysql/mysql.pid general_log = 1 skip-name-resolve #skip-networking back_log = 300 max_connections = 1000 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 max_allowed_packet = 4M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M read_buffer_size = 2M read_rnd_buffer_size = 8M sort_buffer_size = 8M join_buffer_size = 28M key_buffer_size = 4M thread_cache_size = 8 query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed expire_logs_days = 30 performance_schema = 0 explicit_defaults_for_timestamp #lower_case_table_names = 1 myisam_sort_buffer_size = 8M myisam_repair_threads = 1 interactive_timeout = 28800 wait_timeout = 28800 # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Recommended in standard MySQL setup sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,STRICT_TRANS_TABLES [mysqldump] quick max_allowed_packet = 16M [myisamchk] key_buffer_size = 8M sort_buffer_size = 8M read_buffer = 4M write_buffer = 4M

將MySQL編譯生成的bin目錄添加到當前Linux系統的環境變量中:

echo -e '\n\nexport PATH=/usr/local/mysql/bin:$PATH\n' >> /etc/profile && source /etc/profile
建立MySQL數據庫文件的存放路徑以及相關安全配置

在Linux主機上建立一個目錄/mydata/mysql/data,用於存放MySQL的數據庫文件。同時設置其用戶和用戶組爲以前建立的mysql,權限爲777。這樣其它用戶是沒法進行讀寫的,儘可能保證數據庫的安全。

mkdir -p /mydata/mysql/data && chown -R root:mysql /usr/local/mysql chown -R mysql:mysql /mydata/mysql/data chmod -R go-rwx /mydata/mysql/data
初始化MySQL自身的數據庫

在MySQL安裝目錄的\bin\路徑下,執行mysqld命令,初始化MySQL自身的數據庫。

cd /usr/local/mysql/bin mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/mysql/data

執行完後,經過 ls -lrt /mydata/mysql/data/ 命令查看是否生成了MySQL自身的數據庫文件。

建立MySQL日誌存放目錄以及設置開機啓動

下面配置的MySQL日誌存放目錄以及權限都是根據前面my.cnf文件寫的,也就是二者須要保持一致。

 
mkdir -p /var/run/mysql && mkdir -p /var/log/mysql chown -R mysql:mysql /var/log/mysql && chown -R mysql:mysql /var/run/mysql #配置開機自啓動 cp /usr/local/mysql/support-files/mysql.server  /etc/init.d/mysqld chmod +x /etc/init.d/mysqld #增長可執行權限 chkconfig --add mysqld #添加到sysV服務 chkconfig mysqld on

在完成上面的操做後,就能夠正式使用MySQL服務了。啓動MySQL進程服務的命令以下:

[root@172 ~]# mysqld_safe --user=mysql --datadir=/mydata/mysql/data --log-error=/var/log/mysql/error.log & [1] 19077 [root@172 ~]# 2016-10-23T04:21:19.530315Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2016-10-23T04:21:19.563588Z mysqld_safe Starting mysqld daemon with databases from /mydata/mysql/data ######上面這條命令會在後臺繼續執行,因此直接回車並執行下面這條命令 [root@172 ~]# service mysqld start Starting MySQL SUCCESS! 

使用 ps -ef | grep mysql 查看MYSQL服務端進程和端口監聽狀況:

[root@172 ~]# ps -ef | grep mysql root 19077  18966  0 12:21 pts/0    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/mydata/mysql/data --log-error=/var/log/mysql/error.log mysql 19685  19077  0 12:21 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/mydata/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysql/error.log --open-files-limit=65535 --pid-file=/var/log/mysql/mysql.pid --socket=/var/run/mysql/mysql.sock --port=3306 root 20318  18966  0 12:22 pts/0    00:00:00 grep --color=auto mysql
初始化MySQL數據庫的root用戶密碼

和Oracle數據庫同樣,MySQL數據庫也默認自帶了一個root用戶(這個和當前Linux主機上的root用戶是徹底不搭邊的),咱們在設置好MySQL數據庫的安全配置後初始化root用戶的密碼。配置過程當中,一路輸入y就好了。這裏只說明下MySQL5.7.16版本中,用戶密碼策略分紅低級LOW、中等MEDIUM和超強STRONG三種,推薦使用中等MEDIUM級別!

[root@172 ~]# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: y There are three levels of password validation policy: LOW Length >= 8 【只須要長度大於或等於8】 MEDIUM Length >= 8, numeric, mixed case, and special characters        【還須要包含數字、大小寫和相似於@#%等特殊字符】 STRONG Length >= 8, numeric, mixed case, special characters and dictionary file 【還須要包含字典文件】 Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: y
將MySQL數據庫的動態連接庫共享至系統連接庫

通常MySQL數據庫還會被相似於PHP等服務調用,因此咱們須要將MySQL編譯後的lib庫文件添加至當前Linux主機連接庫/etc/ld.so.conf.d/下,這樣MySQL服務就能夠被其它服務調用了。

[root@172 ~]# echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf [root@172 ~]# ldconfig [root@172 ~]# ldconfig -v |grep mysql ldconfig: 沒法對 /libx32 進行 stat 操做: 沒有那個文件或目錄 ldconfig: 屢次給出路徑「/usr/lib」 ldconfig: 屢次給出路徑「/usr/lib64」 ldconfig: 沒法對 /usr/libx32 進行 stat 操做: 沒有那個文件或目錄 /usr/local/mysql/lib: libmysqlclient.so.20 -> libmysqlclient.so.20.3.3
建立其它MySQL數據庫用戶

使用MySQL數據庫root管理員用戶登陸MySQL數據庫後,能夠管理數據庫和其餘用戶了。這裏演示建立一個名爲evai的MySQL用戶(密碼爲@Typeusers2016.com)和一個名爲typeusers的數據庫。

[root@172 ~]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16 Server version: 5.7.16-log Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
######登陸成功後,建立typecodes數據庫,並設置字符集
mysql> CREATE DATABASE `typeusers` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.01 sec)
######建立名爲typecodes用戶,並讓它擁有typecodes數據庫全部的權限
mysql> grant all privileges on typeusers.* to evai@localhost identified by '@Typeusers2016.com'; Query OK, 0 rows affected, 2 warnings (0.01 sec)

  mysql> exit

  Bye

ok,退出,而後用剛建立的用戶登陸到mysql:

[root@172 ~]# mysql -uevai -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 17 Server version: 5.7.16-log Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 

 

安裝nginx

去官網 http://nginx.org 下載最新的穩定版本,複製連接:

 

下載並解壓:

[root@172 ~]# wget http://nginx.org/download/nginx-1.10.2.tar.gz
--2016-10-23 13:22:15--  http://nginx.org/download/nginx-1.10.2.tar.gz
正在解析主機 nginx.org (nginx.org)... 206.251.255.63, 95.211.80.227, 95.211.80.227 正在鏈接 nginx.org (nginx.org)|206.251.255.63|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:910812 (889K) [application/octet-stream] 正在保存至: 「nginx-1.10.2.tar.gz」 100%[=================================================>] 910,812     43.0KB/s 用時 18s 2016-10-23 13:22:35 (49.4 KB/s) - 已保存 「nginx-1.10.2.tar.gz」 [910812/910812])

 [root@172 ~]# tar -zxvf nginx-1.10.2.tar.gz     #解壓

在下載一個叫pcre的東東,PCRE 簡介:PCRE(Perl Compatible Regular Expressions)是一個Perl庫,包括 perl 兼容的正則表達式庫。這些在執行正規表達式模式匹配時用與Perl 5一樣的語法和語義是頗有用的。Boost太龐大了,使用boost regex後,程序的編譯速度明顯變慢。測試了一下,一樣一個程序,使用boost::regex編譯時須要3秒,而使用pcre不到1秒。所以改用pcre來解決C語言中使用正則表達式的問題,簡單來講能夠進行URL重寫,咱們下載過來並解壓

[root@172 ~]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz
[root@172 ~]# tar -zxvf pcre-8.39.tar.gz

進入到nginx文件夾目錄下,編譯安裝:

./configure --prefix=/usr/local/nginx  --with-pcre=../pcre-8.39 #回車
make && make install

安裝完成後進入 /usr/local/nginx 目錄下,能夠看到已經安裝完畢:

[root@172 nginx-1.10.2]# cd /usr/local/nginx/ [root@172 nginx]# ll 總用量 4 drwxr-xr-x. 2 root root 4096 10月 23 13:43 conf drwxr-xr-x. 2 root root   38 10月 23 13:43 html drwxr-xr-x. 2 root root    6 10月 23 13:43 logs drwxr-xr-x. 2 root root   18 10月 23 13:43 sbin

接下來啓動nginx,看到nginx已經啓動:

[root@172 nginx]# cd sbin/ [root@172 sbin]# ./nginx [root@172 sbin]# ps -aux |grep nginx root 32128  0.0  0.0  18112   592 ?        Ss   13:46   0:00 nginx: master process ./nginx nobody 32129  0.0  0.1  18532  1308 ?        S    13:46   0:00 nginx: worker process root 32131  0.0  0.0 112664   984 pts/0    R+   13:46   0:00 grep --color=auto nginx [root@172 sbin]# 

咱們用curl http:/127.0.0.1 測試下是否已經能夠看到信息:

[root@172 nginx]# curl http://127.0.0.1
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>

<p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

沒有問題,打開瀏覽器輸入ip地址訪問:

 

 也是成功的,不過有些小夥伴會打不開,緣由是防火牆開啓了致使訪問失敗,CentOS 7默認使用的是firewall做爲防火牆,咱們輸入 systemctl stop firewalld.service 把它關閉,再次訪問瀏覽器就能夠看到了。附上防火牆的命令:

systemctl start firewalld.service    #啓動firewall
systemctl stop firewalld.service     #中止firewall
systemctl disable firewalld.service  #禁止firewall開機啓動

這個時候咱們還不能訪問php文件的網頁的,由於nginx還沒法解析它,這個時候該php-fpm大展身手了:

[root@172 nginx]# cd /usr/local/php7/sbin/ [root@172 sbin]# ll 總用量 28168
-rwxr-xr-x. 1 root root 28839999 10月 22 23:43 php-fpm [root@172 sbin]# ./php-fpm [23-Oct-2016 14:14:51] ERROR: failed to open configuration file '/usr/local/php7/etc/php-fpm.conf': No such file or directory (2) [23-Oct-2016 14:14:51] ERROR: failed to load configuration file '/usr/local/php7/etc/php-fpm.conf' [23-Oct-2016 14:14:51] ERROR: FPM initialization failed

提示找不到php-fpm.conf文件,進入到 /usr/local/php7/etc 查看,發現只有default文件,把它copy一份到當前目錄下命名爲php-fpm.conf

[root@172 sbin]# cd /usr/local/php7/etc [root@172 etc]# ll 總用量 12
-rw-r--r--. 1 root root 1239 10月 22 23:43 pear.conf -rw-r--r--. 1 root root 4465 10月 22 23:43 php-fpm.conf.default drwxr-xr-x. 2 root root   29 10月 22 23:43 php-fpm.d

  [root@172 etc]# cp php-fpm.conf.default php-fpm.conf

再次啓動仍是報錯,發現conf.d目錄下沒有.conf後綴的文件,同樣copy一份到該目錄下改成www.conf ,再啓動就成功了:

[root@172 etc]# /usr/local/php7/sbin/php-fpm [23-Oct-2016 14:19:14] WARNING: Nothing matches the include pattern '/usr/local/php7/etc/php-fpm.d/*.conf' from /usr/local/php7/etc/php-fpm.conf at line 125. [23-Oct-2016 14:19:14] ERROR: No pool defined. at least one pool section must be specified in config file [23-Oct-2016 14:19:14] ERROR: failed to post process the configuration [23-Oct-2016 14:19:14] ERROR: FPM initialization failed [root@172 etc]# cd php-fpm.d [root@172 php-fpm.d]# ll 總用量 20
-rw-r--r--. 1 root root 18521 10月 22 23:43 www.conf.default [root@172 php-fpm.d]# cp www.conf.default www.conf [root@172 php-fpm.d]# /usr/local/php7/sbin/php-fpm [root@172 php-fpm.d]# ps -aux | grep php-fpm root 32369  0.0  0.2 148336  2548 ?        Ss   14:22   0:00 php-fpm: master process (/usr/local/php7/etc/php-fpm.conf) nobody 32370  0.0  0.2 148336  2200 ?        S    14:22   0:00 php-fpm: pool www nobody 32371  0.0  0.2 148336  2200 ?        S    14:22   0:00 php-fpm: pool www root 32373  0.0  0.0 112664   984 pts/1    R+   14:23   0:00 grep --color=auto php-fp [root@172 php-fpm.d]# 

而後打開編輯 /usr/local/nginx/conf/nginx.conf 文件,找到下面這段並改成以下圖:

location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

再進入html目錄下,建立一個test.php文件:

[root@172 nginx]# cd html/ [root@172 html]# ll 總用量 8
-rw-r--r--. 1 root root 537 10月 23 13:43 50x.html -rw-r--r--. 1 root root 612 10月 23 13:43 index.html [root@172 html]# vim test.php #輸入 <?php phpinfo(); #保存退出 [root@172 html]# ../sbin/nginx -s reload      #從新載入nginx

打開瀏覽器,輸入你的ip地址:http://xxx.xxx.xx.xxx/test.php 訪問:

 

 至此,lnmp環境搭建完成。 

相關文章
相關標籤/搜索