Ubuntu installs LNMP environment using binary package

Source: Internet
Author: User
Tags fpm mcrypt

Apt-get Install Mysql-server

Apt-get Install Nginx

Apt-get Install PHP5-FPM

Install the appropriate support library for PHP

Apt-get Install php5-fpm php5-cli php5-curl php5-gd mcrypt php5-mcrypt php5-mysql

#下面的只是记录一下

Apt-get php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-p s Php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl


Nginx configuration of the multi-medium version:

One

server {

Listen default_server;

Listen [::]:80 default_server Ipv6only=on;


root/usr/share/nginx/html;

Index index.php index.html index.htm;


# make site accessible from http://localhost/

server_name localhost;


Location/{

Try_files $uri $uri//index.php;

}


location/doc/{

alias/usr/share/doc/;

AutoIndex on;

Allow 127.0.0.1;

Allow:: 1;

Deny all;

}


#

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}


Location ~ \.php$ {

# with PHP5-FPM:

Try_files $uri = 404;

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

Include Fastcgi_params;

}


# Deny access to. htaccess files, if Apache ' s document Root

# concurs with Nginx ' s one

#

Location ~/\.ht {

Deny all;

}

}



Nginx Configuration Second:

server {

Listen 80;

Listen [::]:80 default_server Ipv6only=on;


root/usr/share/nginx/html;

Index index.php index.html index.htm;


# make site accessible from http://localhost/

server_name _;


Location/{

# First attempt to serve request as file, then

# as Directory, then fall back to displaying a 404.

Try_files $uri $uri//index.html;

# Uncomment to enable Naxsi

# Include/etc/nginx/naxsi.rules

}


location/doc/{

alias/usr/share/doc/;

AutoIndex on;

Allow 127.0.0.1;

Allow:: 1;

Deny all;

}


# Nginx-naxsi used with nginx-naxsi-ui:process denied requests

#location/requestdenied {

# Proxy_pass http://127.0.0.1:8080;

#}


#error_page 404/404.html;


# REDIRECT Server error pages to the static page/50x.html

#

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}


# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

Location ~. php$ {

Try_files $uri = 404;

Fastcgi_split_path_info ^ (. +.php) (/.+) $;

# note:you should has "cgi.fix_pathinfo = 0;" In php.ini


# with php5-cgi alone:

#fastcgi_pass 127.0.0.1:9000;

# with PHP5-FPM:

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

Include Fastcgi_params;

}


# Deny access to. htaccess files, if Apache ' s document Root

# concurs with Nginx ' s one

#

Location ~/.ht {

Deny all;

}

}



Nginx configures its three:

server {

Listen 80;


server_name example.com;

root/var/www/example.com;


Index index.html index.htm index.php;


Access_log/var/log/nginx/example.com.access.log;

Error_log/var/log/nginx/example.com.error.log;


Location =/favicon.ico {log_not_found off; access_log off;}

Location =/robots.txt {log_not_found off; access_log off;}


Location ~*. (ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt |TAR|MID|MIDI|WAV|BMP|RTF) $ {

Expires Max; Log_not_found off; Access_log off;

}


Location ~ \.php?$ {

Include/etc/nginx/fastcgi_params;

Fastcgi_pass PHP;

}

}


Nginx configures its four:

Location ~. php$ {

Try_files $uri = 404; #增加

Fastcgi_split_path_info ^ (. +.php) (/.+) $; #反注释

# # Note:you should has "cgi.fix_pathinfo = 0;" In php.ini

#

# # with php5-cgi alone:

# Fastcgi_pass 127.0.0.1:9000;

# # with PHP5-FPM:

Fastcgi_pass Unix:/var/run/php5-fpm.sock; #反注释

Fastcgi_index index.php; #反注释

Include Fastcgi_params; #反注释

}


Nginx configure its five:

Location/{

Try_files $uri $uri/= 404;

}


Error_page 404/404.html;

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}


Location ~ \.php$ {

Try_files $uri = 404;

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

Include Fastcgi_params;

}

}


Nginx configures its six:

server {

Listen default_server;

Listen [::]:80 default_server Ipv6only=on;


root/usr/share/nginx/html;

Index index.php index.html index.htm;


server_name server_domain_name_or_ip;


Location/{

Try_files $uri $uri/= 404;

}


Error_page 404/404.html;

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}


Location ~ \.php$ {

Try_files $uri = 404;

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Fastcgi_pass Unix:/var/run/php5-fpm.sock;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}

}


Ubuntu installs LNMP environment using binary package

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.