欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到云服務器

服務器租用

Ubuntu 16.04 LTS系統安裝配置Nginx/PHP 7/MySQL 5.7環境

Nginx (讀”engine x”) 是一款免費、開源的高機能 HTTP 處事。Nginx 不變、富厚的成果集、設置簡樸、資源耗損低。本教程先容了如何通過PHP7支持(通過PHP-FPM)和MySQL5.7支持(LEMP= LINUX + nginx(發音為“engine x”)+ MySQL+ PHP)在Ubuntu 16.04處事器安裝Nginx處事器。

1 劈頭說明

在本教程中,我利用的IP 地點192.168.1.100,主機名server1.example.com。這些配置大概與你的差異,所以你不得不在適當環境下改換他們。

我運行的所有步調在本教程中利用root權限,所以必然要確保你以root身份登錄:

2 安裝 MySQL 5.7

安裝 MySQL 運行呼吁:

apt-get -y install mysql-server mysql-client

你會被要求提供MySQL的root用戶暗碼 :

New password for the MySQL “root” user: <– yourrootsqlpassword
Repeat password for the MySQL “root” user: <– yourrootsqlpassword

Ubuntu 16.04 LTS系統安裝配置Nginx/PHP 7/MySQL 5.7環境

為了確保數據庫處事器,并刪除匿名用戶和測試數據庫,運行mysql_secure_installation呼吁。

mysql_secure_installation

你會問這些問題:

[email protected]:~# mysql_secure_installation

掩護MySQL處事器陳設。

Enter password for user root: <– Enter the MySQL root 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: <– Press y if you want this function or press Enter otherwise.
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : <– Press enter

… skipping.
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
Success.

Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : <– y
Success.

By default, MySQL comes with a database named ‘test’ that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : <– y
– Dropping test database…
Success.

– Removing privileges on test database…
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : <– y
Success.

All done!

MySQL is secured now.

3 安裝 Nginx

在你已經安裝了Apache2的話,那么利用這些呼吁先刪除再安裝nginx:

service apache2 stop
update-rc.d -f apache2 remove
apt-get remove apache2

Ubuntu16.04有Nginx安裝包,我們可以安裝。

apt-get -y install nginx

Start nginx afterwards:

service nginx start

輸入您的Web處事器的IP地點或主機名到欣賞器(譬喻http://192.168.1.100),你應該看到如下頁面:

Ubuntu 16.04 LTS系統安裝配置Nginx/PHP 7/MySQL 5.7環境

在Ubuntu16.04的默認nginx的文檔根目次為/var/www/html

4 安裝 PHP 7

我們可以通過使nginx的PHP事情PHP-FPM(PHP-FPM(FastCGI歷程打點器)是為任何局限的網站,尤其是忙碌的網站有用的一些附加成果的替代PHP的FastCGI實現),我們安裝如下:

apt-get -y install php7.0-fpm

5 設置 nginx

打開設置文件 /etc/nginx/nginx.conf:

nano /etc/nginx/nginx.conf

設置是很容易領略 (你可以點擊官方教程: http://wiki.nginx.org/NginxFullExample 或:http://wiki.nginx.org/NginxFullExample2)

首先(這是可選)調解keepalive_timeout到一個公道的值:

[...]
    keepalive_timeout   2;
[...]

虛擬主機處事器{}容器界說。默認的虛擬主機是在文件中界說的/etc/nginx/sites-available/default – 讓我們來修改它,如下所示:

nano /etc/nginx/sites-available/default

[...]
server {
 listen 80 default_server;
 listen [::]:80 default_server;
 # SSL configuration
 #
 # listen 443 ssl default_server;
 # listen [::]:443 ssl default_server;
 #
 # Note: You should disable gzip for SSL traffic.
 # See: https://bugs.debian.org/773332
 #
 # Read up on ssl_ciphers to ensure a secure configuration.
 # See: https://bugs.debian.org/765782
 #
 # Self signed certs generated by the ssl-cert package
 # Don't use them in a production server!
 #
 # include snippets/snakeoil.conf;
 root /var/www/html;
 # Add index.php to the list if you are using PHP
 index index.html index.htm index.nginx-debian.html;
 server_name _;
 location / {
 # First attempt to serve request as file, then
 # as directory, then fall back to displaying a 404.
 try_files $uri $uri/ =404;
 }
 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 location ~ .php$ {
 include snippets/fastcgi-php.conf;
 # With php7.0-cgi alone:
 # fastcgi_pass 127.0.0.1:9000;
 # With php7.0-fpm:
 fastcgi_pass unix:/run/php/php7.0-fpm.sock;
 }
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 location ~ /.ht {
  deny all;
 }
}
[...]

server_name _; 使這是一個默認捕獲所有虛擬主機(雖然,你可以同時喜歡這里www.example.com指定主機名)。

根目次 /var/www/html;意味著文檔根目次/var/www/html.

PHP的重要構成部門位置 ~ .php$ {} stanza. 打消注釋它來啟用它。

此刻生存文件并從頭加載nginx:

service nginx reload

下一步打開 /etc/php/7.0/fpm/php.ini…

nano /etc/php/7.0/fpm/php.ini

配置 cgi.fix_pathinfo=0:

騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國外vps服務器租用 夢飛云服務器租用 版權所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 云梦县| 东明县| 沛县| 蒲江县| 南投县| 林甸县| 南阳市| 涟水县| 左云县| 丹凤县| 新乡市| 贵溪市| 静宁县| 句容市| 田东县| 黔东| 双峰县| 山西省| 德兴市| 淳化县| 准格尔旗| 砚山县| 民丰县| 屏东市| 阜平县| 缙云县| 台前县| 台东市| 台山市| 怀集县| 六安市| 汝阳县| 绩溪县| 隆德县| 乐至县| 满城县| 兴国县| 长宁区| 三亚市| 布尔津县| 沛县|