ubuntu使用二进制包安装lnmp环境

apt-get install mysql-server

apt-get install nginx

apt-get install php5-fpm

安装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-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

nginx的配置的多中版本:

其一:

server {

listen 80 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 500 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配置其二:

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 on this location

# include /etc/nginx/naxsi.rules

}

location /doc/ {

alias /usr/share/doc/;

autoindex on;

allow 127.0.0.1;

allow ::1;

deny all;

}

# Only for 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 500 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 have "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配置其三:

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配置其四:

location ~ .php$ {

try_files $uri =404; #增加

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

## NOTE: You should have "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配置其五:

location / {

try_files $uri $uri/ =404;

}

error_page 404 /404.html;

error_page 500 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配置其六:

server {

listen 80 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 500 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;

}

}

时间: 2024-10-14 12:21:48

ubuntu使用二进制包安装lnmp环境的相关文章

cenos6.5源码包安装lnmp环境

虽然centos6可以用yum安装nginx,但是我还是写个教程用源码包安装用于线上环境. 一:在nginx官网下载nginx,并安装 我下载的是nginx-1.6.0 #./configure --prefix=/usr/local/nginx make&& make install 卸载已存在的apache服务和php [[email protected] Desktop]# yum remove httpd php* 安装development Tools [[email prote

ubuntu12.04 apt-get安装 lnmp环境(转)

1.安装mysql [sql] view plaincopy sudo apt-get install mysql-server mysql-client 安装过程中要输入root用户的密码. 我在安装中出错,是原来的mysql-cilent mysql-workbench 未完全卸载,将mysql组件完全卸载的方法: 删除mysql前 先删除一下 /var/lib/mysql 还有 /etc/mysql [sql] view plaincopy sudo rm /var/lib/mysql/ 

Centos 6.8编译安装LNMP环境

Centos 6.8编译安装LNMP环境 参考资料: http://www.jb51.net/article/107429.htm https://phperzh.com/articles/1360 一 准备工作 环境介绍: OS:Centos 6.8 最小化安装 Nginx:nginx-1.12.2.tar.gz mysql:mysql-boost-5.7.20.tar.gz php:php-7.2.0.tar.bz2 1.1.关闭SELINUX # 修改配置文件,重启服务后永久生效. sed

二进制包安装MySQL数据库

1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) [[email protected]_server ~]# mkdir -p /home/shangbao_zhangdc/tools  ##创建指定工具包存放路径[[email protected]_server ~]# wget http://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.32-linux2.6-x86_64.tar.gz  ##下二进制包,这个

Nginx部署文档(二进制包安装)

Nginx部署文档(二进制包安装) 创建时间:2016-06-27 修改时间:2017-03-04 修改时间:2017-03-06 文档目的2 基础知识2 常用命令2 系统环境2 操作步骤3 1. 安装依赖3 2. 安装nginx3 3. 启动nginx5 3. 关闭防火墙6 4. 修改生产环境配置6 常见问题7 问题一:报错"cp: `conf/koi-win' and `/usr/local/nginx/conf/koi-win' are the same file"7 问题二:[

CentOS编译安装LNMP环境

这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables   #编辑防火墙配置文件 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state -

二进制包安装golang

之前讲过arm平台上的golang的源代码编译安装,这次补充下golang官方提供的其它平台上二进制包安装方法. 1.下载golang二进制包 首先是要下载golang的二进制包,官方下载地址:https://golang.org/dl/ 选择对应平台的二进制包,目前golang官方只提供了以下平台的二进制包: 1.1 基于386或amd64处理器的Mac OS X 10.6+平台二进制包 1.2 基于386或amd64处理器的FreeBSD 8+平台的二进制包 1.3 基于386或amd64处

Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

之前在Ubuntu12.04上搭建过PHP开发环境,按照这里http://budongzhenren.blog.51cto.com/2288320/991365安装的.但是系统换成14.04后,再用这个方法安装一直不成功,让我很郁闷,折腾了好久,后来才发现在12.04上安装Nginx,默认的网站根目录在 /usr/share/nginx/www,而在14.04上,默认的网站根目录是 /usr/share/nginx/html. 在Ubuntu14.04上搭建PHP环境的步骤参考这里:http:/

centos下编译安装LNMP环境

自PHP-5.3.3起,PHP-FPM加入到了PHP核心,编译时加上--enable-fpm即可提供支持. PHP-FPM以守护进程在后台运行,Nginx响应请求后,自行处理静态请求,PHP请求则经过fastcgi_pass交由PHP-FPM处理,处理完毕后返回. Nginx和PHP-FPM的组合,是一种稳定.高效的PHP运行方式,效率要比传统的Apache和mod_php高出不少. 二.依赖环境 yum -y install gcc gcc-c++ make cmake automake au