码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2015-12-29 19:38:06      阅读:333      评论:0      收藏:0      [点我收藏+]

标签: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;

    }

}


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

标签:lnmp

原文地址:http://ting2junshui.blog.51cto.com/975290/1729673

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!