<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ## 步驟一:準備編譯環境 2. 關閉防火墻。 1. 運行systemctl status firewalld命令查看當前防火墻的狀態。 [![查看防火墻狀態](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/64105/156560602432172_zh-CN.png)](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/64105/156560602432172_zh-CN.png) * 如果防火墻的狀態參數是inactive,則防火墻為關閉狀態。 * 如果防火墻的狀態參數是active,則防火墻為開啟狀態。本示例中防火墻為開啟狀態,因此需要關閉防火墻。 2. 關閉防火墻。如果防火墻為關閉狀態可以忽略此步驟。 * 如果您想臨時關閉防火墻,運行命令systemctl stop firewalld。 **說明**這只是暫時關閉防火墻,下次重啟Linux后,防火墻還會開啟。 * 如果您想永久關閉防火墻,運行命令systemctl disable firewalld。 **說明**如果您想重新開啟防火墻,請參見[firewalld官網信息](https://firewalld.org/)。 3. 關閉SELinux。 1. 運行getenforce命令查看SELinux的當前狀態。 [![查看SELinux狀態](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/9763/156560602421065_zh-CN.png)](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/9763/156560602421065_zh-CN.png) * 如果SELinux狀態參數是Disabled, 則SELinux為關閉狀態。 * 如果SELinux狀態參數是Enforcing,則SELinux為開啟狀態。本示例中SELinux為開啟狀態,因此需要關閉SELinux。 2. 關閉SELinux。如果SELinux為關閉狀態可以忽略此步驟。 * 如果您想臨時關閉SELinux,運行命令setenforce 0。 **說明**這只是暫時關閉SELinux,下次重啟Linux后,SELinux還會開啟。 * 如果您想永久關閉SELinux,運行命令vi /etc/selinux/config編輯SELinux配置文件。回車后,把光標移動到`SELINUX=enforcing`這一行,按`i`鍵進入編輯模式,修改為`SELINUX=disabled`, 按`Esc`鍵,然后輸入`:wq`并按`Enter`鍵以保存并關閉SELinux配置文件。 **說明**如果您想重新開啟SELinux,請參見[SELinux的官方文檔](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/deployment_guide/ch-selinux#s1-SELinux-resources)。 3. 重啟系統使設置生效。 ## 步驟二:安裝Nginx 完成以下操作,安裝Nginx。 1. 運行以下命令安裝Nginx。vim /etc/yum.repos.d/nginx.repo ,添加以下內容 ``` [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1 ``` 2. 運行以下命令查看Nginx版本。 ~~~ yum -y install nginx nginx -v ~~~ 返回結果如下所示,表示Nginx安裝成功。 ~~~ nginx version: nginx/1.12.2 ~~~ ## 步驟三:安裝MySQL 完成以下操作,安裝MySQL。 1. 運行以下命令更新YUM源。 ~~~ rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm ~~~ 2. 運行以下命令安裝MySQL。 ~~~ yum -y install mysql-community-server ~~~ 3. 運行以下命令查看MySQL版本號。 ~~~ mysql -V ~~~ 返回結果如下所示,表示MySQL安裝成功。 ~~~ mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper ~~~ ## 步驟四:安裝PHP 完成以下操作,安裝PHP。 1. 依次運行以下命令更新YUM源。 ~~~ # yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-15.ius.centos7.noarch.rpm # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm ~~~ **說明**本教程以`ius-release-1.0-15.ius.centos7.noarch.rpm`版本為例。實際安裝過程中,請您使用最新版本ius-release軟件包。 2. 運行以下命令安裝PHP及擴展包。 ~~~ yum -y install php70w-devel php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-mysqlnd php70w-fpm php70w-opcache php70w-pecl-redis php70w-pecl-mongo ~~~ 3. 運行以下命令查看PHP版本。 ~~~ php -v ~~~ 返回結果如下所示,表示安裝成功。 ~~~ PHP 7.0.33 (cli) (built: Dec 6 2018 22:30:44) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies ~~~ ## 步驟五:配置Nginx ### nginx默認目錄 /usr/share/nginx/html/ 1. 運行以下命令備份Nginx配置文件。 ~~~ cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak ~~~ 2. 運行以下命令打開Nginx配置文件。 ~~~ vim /etc/nginx/conf.d/default.conf ~~~ 3. 按`i`進入編輯模式。 4. 在`Server`大括號內,添加下列配置信息,使Nginx支持PHP請求。 ~~~ server { listen 80; server_name localhost; root /var/www; #1.新增root路徑 #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /var/www; index index.php index.html index.htm; #2.新增index.php #修改2:這里新增url重寫(path) try_files $uri $uri/ /index.php$is_args$args; } #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 /var/www; #3.修改路徑 } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} location ~ \.php$ { root /var/www/; #打開并修改php路徑 fastcgi_pass 127.0.0.1:9000; #Nginx通過本機的9000端口將PHP請求轉發給PHP-FPM進行處理。 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #修改4:修改fastcig的路徑 include fastcgi_params; #Nginx調用fastcgi接口處理PHP請求 } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } ~~~ **說明**若不添加此配置信息,則Nginx無法處理您的PHP請求,即您請求的PHP頁面將無法打開。 5. 運行以下命令啟動Nginx服務。 ~~~ systemctl start nginx ~~~ 6. 運行以下命令設置Nginx服務開機自啟動。 ~~~ systemctl enable nginx ~~~ ## 步驟六:配置MySQL 完成以下操作,配置MySQL。 1. 運行以下命令啟動MySQL服務。 ~~~ systemctl start mysqld ~~~ 2. 運行以下命令設置MySQL服務開機自啟動。 ~~~ systemctl enable mysqld ~~~ 3. 運行以下命令查看/var/log/mysqld.log文件,獲取并記錄root用戶的初始密碼。 ~~~ # grep 'temporary password' /var/log/mysqld.log 2016-12-13T14:57:47.535748Z 1 [Note] A temporary password is generated for root@localhost: p0/G28g>lsHD ~~~ **說明**下一步重置root用戶密碼時,會使用該初始密碼。 4. 運行以下命令配置MySQL的安全性。 ~~~ mysql_secure_installation ~~~ 安全性的配置包含以下五個方面: 1. 重置root賬號密碼。 ~~~ Enter password for user root: #輸入上一步獲取的root用戶初始密碼 The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. Using existing password for root. Estimated strength of the password: 100 Change the password for root ? ((Press y|Y for Yes, any other key for No) : Y #是否更改root用戶密碼,輸入Y New password: #輸入新密碼,長度為8至30個字符,必須同時包含大小寫英文字母、數字和特殊符號。特殊符號可以是()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/ Re-enter new password: #再次輸入新密碼 Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y ~~~ 2. 輸入`Y`刪除匿名用戶賬號。 ~~~ By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y #是否刪除匿名用戶,輸入Y Success. ~~~ 3. 輸入`Y`禁止root賬號遠程登錄。 ~~~ Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y #禁止root遠程登錄,輸入Y Success. ~~~ 4. 輸入`Y`刪除test庫以及對test庫的訪問權限。 ~~~ Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y #是否刪除test庫和對它的訪問權限,輸入Y - Dropping test database... Success. ~~~ 5. 輸入`Y`重新加載授權表。 ~~~ Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y #是否重新加載授權表,輸入Y Success. All done! ~~~ 5.在終端輸入“`mysql -u root -p`”登入數據庫 6.新建數據庫 MySQL \[(none)\]> create database wpdb; Query OK, 1 row affected (0.00 sec) 7.創建供wordpress調用數據庫的賬戶: 這里wpdb數據庫賬戶為:wpdb,密碼為b=IA=X5jBs(j ~~~ MySQL [(none)]> grant all privileges on wpdb.* to 'wpdb'@'localhost' identified by 'b=IA=X5jBs(j'; Query OK, 0 rows affected, 1 warning (0.00 sec) ~~~ 更多詳情,請參見[MySQL官方文檔](http://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html)。 ## 步驟七:配置PHP 完成以下操作,配置PHP。 1. 在/usr/share/php的默認目錄下新建phpinfo.php文件,用于展示phpinfo信息。具體步驟如下: 1. 運行vim /var/www/phpinfo.php命令打開文件。 2. nginx那已經修改為 /var/www目錄 3. 輸入下列內容。 ``` <?php $dbhost = 'localhost:3306'; // mysql服務器主機地址 $dbuser = 'root'; // mysql用戶名 $dbpass = '123456'; // mysql用戶名密碼 $conn = mysqli_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('連接錯誤: ' . mysqli_error($conn)); } echo '連接成功<br />'; $sql = 'CREATE DATABASE RUNOOB'; $retval = mysqli_query($conn,$sql ); if(! $retval ) { die('創建數據庫失敗: ' . mysqli_error($conn)); } echo "數據庫 RUNOOB 創建成功\n"; mysqli_close($conn); //輸出php信息 php echo phpinfo(); ?> ``` 2. ``` 配置 php 安裝完成之后,我們需要對它進行一些配置。首先,我們打開配置文件: vim /etc/php.ini 打開文件后,我們找到 cgi.fix_pathinfo 并把它的值設置為 0 #配置好 php.ini 文件之后,我們來配置 /etc/php-fpm.d/www.conf 文件 vim /etc/php-fpm.d/www.conf #第一處修改,將 listen = 127.0.0.1:9000 修改為如下: listen = /var/run/php-fpm/php-fpm.sock #然后找到下面兩行,刪掉前面的 ; 分號,取消注釋。 listen.owner = nobody listen.group = nobody #最后,我們找到下面兩行 user = apache group = apache #將 apache 換成 nginx,如下所示: user = nginx group = nginx 好,這樣,我們就已經安裝并且配置好了。下面我們可以啟動了。 # 啟動PHP systemctl start php-fpm # 將它設置為開機啟動 systemctl enable php-fpm ``` ## 步驟八:測試訪問LNMP平臺 完成以下操作,測試訪問LNMP平臺。 1. 打開瀏覽器。 2. 在地址欄輸入`http://<ECS實例公網IP地址>/phpinfo.php`。 返回結果如下圖所示,表示LNMP環境部署成功。 [![LNMP部署成功](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/64105/156560602544922_zh-CN.png)](http://static-aliyun-doc.oss-cn-hangzhou.aliyuncs.com/assets/img/64105/156560602544922_zh-CN.png) ## 步驟九:安裝Wordpress 網站系統 執行以下命令: ~~~ cd /var/wordpress/ wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.zip unzip wordpress-4.9.4-zh_CN.zip mv wordpress/* /var/wordpress/ cd /var/ chmod 755 -R wordpress chown nginx:nginx -R wordpress ~~~ ## 后續步驟 測試訪問LNMP平臺成功后,建議您運行以下命令將/usr/share/php/phpinfo.php文件刪除,消除安全隱患。 ~~~ rm -rf /usr/share/php/phpinfo.php ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看