In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to install Nginx+php environment on Ubuntu/Debian". In daily operation, I believe many people have doubts about how to install Nginx+php environment on Ubuntu/Debian. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "how to install Nginx+php environment on Ubuntu/Debian". Next, please follow the editor to study!
0. Begin to pay attention.
To complete the operations mentioned in the tutorial, we assume that you have installed a basic Debian or Ubuntu operating system. This is a different tutorial on how to install the system, so I won't explain it in detail here. This tutorial focuses on how to easily get the running environment of Nginx+php.
1. Install Nginx
The first step is to download from the library, which is very simple.
Sudo apt-get install nginx
Change the default virtual site configuration, which can be found in:
Sudo vim / etc/nginx/sites-available/default
A beautiful key configuration is:
Server {listen 80; server_name localhost; access_log / var/log/nginx/localhost.access.log;## Default location location / {root / var/www; index index.php;} # # Images and static content is treated different location ~ * ^. (jpg | jpeg | gif | css | png | js | ico | xml) ${access_log off; expires 30d; root / var/www } # # Parse all .php file in the / var/www directory location ~ .php ${fastcgi_split_path_info ^ (. + .php) (. *) $; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / var/www$fastcgi_script_name; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method Fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k Fastcgi_temp_file_write_size 256k;} # # Disable viewing .htaccess & .htpassword location ~ / .ht {deny all;}} upstream backend {server 127.0.0.1 virtual 9000;}
All right, we're done here, and now we need to install the files needed for PHP.
two。 Install PHP
Many sites use PHP to provide dynamic content, they may be a wiki, a blog, or a forum or something.
If you are running Ubuntu, we need to solve two different deb packages first. If you are running the amd64 version, you need to change i386 to amd64
Note: if it's debian, you don't need to do this.
Cd / tmpwget http://us.archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb53_1.6.dfsg.4~beta1-5ubuntu2_i386.debwget http://us.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu0.2_i386.debsudo dpkg-I * .deb
Again, this only needs to be done on Ubuntu, and this can be omitted if it is the latest version of 12.04.
The rest of the following will be common to both Ubuntu and Debian.
We need to add APT sources to add deb packages, so we can use php5.3 and php-fpm
Sudo echo "deb http://php53.dotdeb.org stable all" > > / etc/apt/sources.list
Update apt:
Sudo apt-get update
Let's start installing PHP (part I)
Sudo apt-get install php5-cli php5-common php5-suhosin
We need to install the command line, or there will be some minor problems.
Sudo apt-get install php5-fpm php5-cgi
If you plan to use the database or some required modules (e.g. mcrypt,ldap,snmp, etc.) you can also install them.
Well, we have now finished installing nginx and php
One caveat: if you use the short tag "php" (
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.