注册 登录
自由的生活_软路由 返回首页

心想事成的个人空间 https://bbs.routerclub.com/?681 [收藏] [复制] [分享] [RSS]

日志

install nginx+php+mysql on debian 7.1.0

已有 1918 次阅读2013-11-8 14:07 | mysql

install nginx+php+mysql on debian 7.1.0

debian , nginx

1. Installing MySQL 5

1
apt-get install mysql-server mysql-client

2. Installing Nginx

1
2
apt-get install nginx
/etc/init.d/nginx start

3. Installing PHP5

1
apt-get install php5-fpm php5-mysql

4. Configuring Nginx

1
vi /etc/nginx/nginx.conf
1
2
3
4
5
[...]
worker_processes  4;
[...]
keepalive_timeout  2;
[...]
1
vi /etc/nginx/sites-available/default
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[...]
server {
        listen   80; ## listen for ipv4; this line is default and implied
        listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
                                   
        root /usr/share/nginx/www;
        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 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/www;
        }
                                   
        # 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;
        }
}
[...]
1
/etc/init.d/nginx reload
1
vi /etc/php5/fpm/php.ini
1
2
3
[...]
cgi.fix_pathinfo=0
[...]
1
/etc/init.d/php5-fpm reload
1
vi /usr/share/nginx/www/phpinfo.php
1
2
3
<?php
phpinfo();
?>

Another way:

1
2
3
4
5
6
aptitude install nginx
aptitude install php5-fpm
aptitude install php5-mysql
service php5-fpm restart
service nginx restart
aptitude install mysql-server mysql-client

That's all.


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-5 17:56 , Processed in 0.079689 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

返回顶部