Ngnix 安装及配置
来源:互联网 发布:淘宝店铺口令怎么生成 编辑:程序博客网 时间:2024/05/17 22:06
安装Nginx
sudo apt-get install nginx安装php及php常用插件
sudo apt-get install php5-cgi php-apc php5-curl php5-gd php5-mysql php5-mcrypt php5-memcache php5-memcached
安装Php-fpm
sudo apt-get install php5-fpm
配置
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
listen 8080; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /var/nginx;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
index index.php
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;
deny all;
}
# Only for nginx-naxsi : process denied requests
#location /RequestDenied {
# For example, return an 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;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
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 /etc/nginx/fastcgi_params;
fastcgi_intercept_errors on;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 8080;
root /var/nginx/ecweb/src/www;
index index.php index.html index.htm;
server_name ya.com; #must oonfig to hosts file example: 127.0.0.1 ya.com
set $application_env "development";
location / {
index index.php index.html index.htm;
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php last;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SLIM_ENV_MODE $application_env;
}
}
server {
listen 8080;
root /var/nginx/mm/src/www-admin;
index index.php index.html;
server_name admin.usercenter.mm.cn;
location / {
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?$1&;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
include fastcgi_params;
fastcgi_param APPLICATION_ENV $application_env;
}
}
server {
listen 8080;
root /var/nginx/mm/src/www-overseas;
index index.php index.html;
server_name oe.mm.cn;
location / {
if (!-f $request_filename) {
rewrite ^/(.+)$ /index.php?$1&;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
include fastcgi_params;
fastcgi_param APPLICATION_ENV $application_env;
}
}
- Ngnix 安装及配置
- ngnix配置及实战
- Ngnix安装与配置
- (一)Ngnix在Windows下的安装及环境配置
- linux+ngnix+php 安装配置
- Ngnix 安装、信号量、虚拟主机配置
- Ngnix 安装、信号量、虚拟主机配置
- ngnix安装配置以及代理配置
- ubuntu下面ngnix的安装配置
- ubuntu-ngnix安装配置[亲测可用]
- NAMP安装(三) ngnix 负载均衡 配置
- ngnix 配置
- ngnix配置
- Ngnix配置
- ngnix配置
- ngnix安装
- ngnix安装
- linux 下laravel5项目搭建及ngnix配置
- 线性表插入和删除——程序实例
- H - Hurdles of 110m----(2015 summer training #4 (Qualifying))
- [leetcode-80]Remove Duplicates from Sorted Array II(C)
- 测试种类介绍---可补充
- openerp参数db-filter使用说明
- Ngnix 安装及配置
- 关于一些博客记录
- Bartender使用心得
- 快速排序法
- excel文件,用read.xlsx别用read.csv了
- php字符串
- table表格动态增加行/删除行,动态给highchart赋值
- 最近邻与K近邻算法思想
- Eclipse中import新的工程报错的解决方法