Install Php+nginx on Ubuntu

Source: Internet
Author: User
Install Php+nginx under Ubuntu

? system Environment: Ubuntu12.04 Desktop

?

?

1, sudo apt-get install php5-cgi

??? (Because Nginx only supports fast-cgi, so install php5-cgi)

? Prompt to install the following resources

?

The following additional packages will be installed:  libapache2-mod-php5 php5-cli Php5-common php5-gd Php5-mysql recommended Packages Installed:  php-pear php5-suhosin The following " The new "package will be installed:  php5-cgi The following packages will be upgraded:  libapache2-mod-php5 php5-cli Php5-common php5-gd php5-mysql

?

2. sudo apt-get install Nginx

?

?

3, Vim/etc/nginx/site-available/default

?

server {#listen; # listen for IPv4; the "This" is default and implied #listen [::]:80 Defaul T Ipv6only=on; # # Listen for IPv6 root/usr/share/nginx/www; Index index.html index.htm; # make site accessible from Http://localhost/28 server_name localhost; Location/{+ # First attempt to serve request as file, then # as dire Ctory, then fall index.html try_files $uri $uri//index.html;         # Uncomment to enable Naxsi in this location # Include/etc/nginx/naxsi.rules 36                 } Notoginseng location/doc/{alias/usr/share/doc/; autoindex on; 41 Allow 127.0.0.1; Deny all;                 * For Nginx-naxsi:process denied requests #location/requestdenied {47 # For example, returnAn error code #return 418; #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/usr/share/nginx/www; HP scripts to FastCGI server listening on 127.0.0.1:9000 # $ location ~ \.php$ {$ # FA Stcgi_split_path_info ^ (. +\.php) (/.+) $; # note:you should has "cgi.fix_pathinfo = 0;" In php.ini CGI alone:67 Fastcgi_pass 127.0.0.1:9000; php5-fpm:69 # Fastcgi_pass Unix:/var/run/php5-fpm.sock; Fastcgi_param script_filename $document _root$fastcgi_script_name;              Fastcgi_index index.php;                                                       }

?

Sudo/etc/init.d/nginx Restart? (Note that this is the Sduo way to restart, or because the permissions file error)

?

4, Vim index.php? (Create file index.php test under/usr/share/nginx/www)

?

?

 
  
?

The result is the following error : Connect () failed (111:connection refused) while connecting to upstream

?

That's because there's no installation? PHP5-FMP

?

5, sudo apt-get install PHP5-FMP

?

After restarting the Nginx service, you can see the results of the page.

?

?

Add : When installing the phpMyAdmin error:? phpmyadmin missing mysqli extension

?

Check whether Extension=php_mysqli.dll is enabled under the/etc/php5/apache2/php.ini file

?

?

?

?

?

?

?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    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.