Home Backend Development PHP Tutorial ubuntu builds LNMP + Yii

ubuntu builds LNMP + Yii

Jul 29, 2016 am 08:57 AM
apt fastcgi nbsp nginx php

Install Mysql

apt-get install mysql-server mysql-client
The default version installed is version 5.5, which is not the latest version
The process is relatively simple and not much described.

Install Nginx

apt-get install nginx
Default version 1.4.6
Uninstall script: apt-get –purge remove nginx

If you want to install the latest version, you can do this:
1. Add nginx apt source to /etc/apt/sources.list
Copy
deb http://nginx.org/packages/ubuntu/ trusty nginx
deb-src http://nginx.org/packages/ubuntu/ trusty nginx
Add to /etc/apt/sources.list file
The above configuration may be updated. For the latest configuration, please refer to: http://nginx.org/en/linux_packages.html#stable

2. Update apt-key
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
If you do not perform this step, an error similar to this will appear when performing the following steps:
GPG error: http://nginx.org precise Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY ABF5BD827BD9BF62

3. Update apt
apt-get update

4. Reinstall nginx
apt-get install nginx

5. After installation, visit localhost. If there is a welcome page for nginx, it means the installation is successful.
sudo service nginx restart // Restart

Install PHP5

apt-get install php5-fpm
apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-imagick php5-mcrypt
php5-memcache php5-sqlite php5-xmlrpc php5-json php5-common php5-dev php5-redis

View the php5 running process
ps -waux | grep php5
Open and close the php5 process
sudo service php5-fpm stop
sudo service php5-fpm start
sudo service php5-fpm restart
sudo service php5-fpm status

configuration

vim /etc/nginx/conf.d/default.conf
1. Specify the correct root
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location = /50x.html {
root /usr/share/nginx/html;
}
2. Enable support for php
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php{
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
document_root$fastcgi_script_name;
include fastcgi_params;
}

vim /etc/php5/fpm/php.ini
cgi.fix_pathinfo = 1 Remove the comments

vim /etc/php5/fpm/pool.d/www.conf
;listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000

Configuration completed!

Download the yii framework code

http://www.yiichina.com/doc/guide/2.0/start-installation

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces how to build LNMP + Yii on ubuntu, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What's wrong with nginx running for a while? What's wrong with nginx running for a while? Apr 14, 2025 am 07:18 AM

The reasons why nginx hangs up after running for a period of time: 1. Memory leak; 2. Configuration error; 3. Insufficient resources; 4. External factors. Solution: 1. Diagnose memory leaks; 2. Fix configuration errors; 3. Provide more resources; 4. Exclude external factors.

How to implement nginx load balancing How to implement nginx load balancing Apr 14, 2025 am 07:21 AM

Nginx load balancing defines backend servers through the upstream module and uses the location block to proxy the request to these servers. Supports load balancing strategies such as polling, minimum number of connections, response time weighting, and ip_hash. Configuration examples include defining an upstream group and pointing to it using the proxy_pass directive.

nginx restart command nginx restart command Apr 14, 2025 am 07:27 AM

nginx restart command: sudo systemctl restart nginx. Other related commands include: 1. Start: sudo systemctl start nginx; 2. Stop: sudo systemctl stop nginx; 3. Check status: sudo systemctl status nginx.

Apr 14, 2025 am 07:36 AM

Nginx Autoindex is a function of generating directory listing HTML pages, which is used to browse files and view file information when requesting directories instead of files. It can be customized with configuration options such as displaying the exact file size, local time, and custom page format. Advantages include easy browsing, easy configuration and providing file information. Disadvantages include security risks, performance impact, and the inability to customize the appearance of the page.

What is the reason for nginx403 What is the reason for nginx403 Apr 14, 2025 am 07:39 AM

nginx 403 error indicates that the client does not have permission to access the resource. Factors that cause this problem may include: permission settings, nginx configuration, CGI script errors, .htaccess files, or other reasons. Troubleshooting steps include: checking permission settings, reviewing nginx configuration, testing CGI scripts, checking .htaccess files, excluding firewalls or security software, and checking servers and file systems.

How to configure virtual hosts in nginx How to configure virtual hosts in nginx Apr 14, 2025 am 08:15 AM

Configuring nginx virtual host allows multiple websites to be hosted on a single server, each with a separate domain name and root directory. The specific configuration steps include: creating a virtual host configuration file to configure the server block, specifying the server listening port, virtual host domain name and document root directory to enable the virtual host, and linking the configuration file to the enabled directory to reload nginx

How to redirect in nginx How to redirect in nginx Apr 14, 2025 am 08:42 AM

Methods for redirecting through Nginx are 301 permanent redirects (update links or mobile pages) and 302 temporary redirects (handling errors or temporary changes). Configuring redirection involves using location directives in server blocks, advanced features include regular expression matching, proxy redirection, and condition-based redirection. Common uses of redirects include updating URLs, handling errors, redirecting HTTP to HTTPS, and guiding users to a specific country or language version.

The relationship between nginx and web server The relationship between nginx and web server Apr 14, 2025 am 07:09 AM

nginx is a lightweight, non-blocking web server and reverse proxy, commonly used for front-end proxy, load balancing, and caching. Its relationship with a web server is usually: Front-end proxy: nginx handles requests and forwards them to the back-end server. Load Balancer: nginx distributes requests to multiple backend servers. Caching: nginx caches frequently accessed files for performance.

See all articles