Ubuntu 16.04 LTS 安裝配置 Nginx 1.10.0 Php7.0-FPM

來源:互聯網
上載者:User

標籤:

1. 安裝Nginx,Php-7.0

~$ sudo add-apt-repository ppa:nginx/stable

~$ sudo apt-get update

~$ sudo apt-get install nginx

~$ nginx -v

nginx version: nginx/1.10.0

~$ sudo apt-get install php

~$ php -v

PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )

Copyright (c) 1997-2016 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

2. 配置Nginx的監聽連接埠為8080(Apache2的服務已經安裝在我的系統中了,預設的監聽連接埠80被佔用)。

~$ sudo vim /etc/nginx/sites-available/default

server {

listen 8080 default_server;

listen [::]:8080 default_server;

3. 配置Nginx和Php7.0-FPM 啟用php7.0-FPM服務並在Nginx中生效

~$ sudo vim /etc/nginx/sites-available/default

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;

}

~$ sudo vim /etc/php/7.0/fpm/php-fpm.conf

; The address on which to accept FastCGI requests.

; Valid syntaxes are:

;  ‘ip.add.re.ss:port‘    - to listen on a TCP socket to a specific IPv4 address on

;                            a specific port;

;  ‘[ip:6:addr:ess]:port‘ - to listen on a TCP socket to a specific IPv6 address on

;                            a specific port;

;  ‘port‘                - to listen on a TCP socket to all addresses

;                            (IPv6 and IPv4-mapped) on a specific port;

;  ‘/path/to/unix/socket‘ - to listen on a unix socket.

; Note: This value is mandatory.

listen = /run/php/php7.0-fpm.sock

4. 測試

~$ sudo service php7.0-fpm start

~$ sudo service ngnix start

 

訪問 127.0.0.1:8080/phpinfo.php 出現phpinfo資訊頁面則為配置成功!

 

轉http://www.jianshu.com/p/95ac61e6f0d0

Ubuntu 16.04 LTS 安裝配置 Nginx 1.10.0 Php7.0-FPM

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.