Debian 7.1 下配置各种WEB环境

来源:互联网 发布:编程笔记本配置要求 编辑:程序博客网 时间:2024/05/18 02:01

一、NGINX

(一)发布NODEJS示例:

1、在/etc/nginx/conf.d目录下,新建站点名配置,如:sitename.conf

2、在sitename.conf加入如下内容:

 server {
        listen 80;
        server_name sitename.com www.sitename.com;
        location / {
                root html;
                index index.html;
        proxy_pass http://127.0.0.1:8070; ##nodejs的端口
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
                }
        }

(二)发布jsp示例:

同(一)发布NODEJS示例

(三)发布php5示例:

1、将/etc/php5/fpm/pool.d目录的www.conf文件listen = /var/run/php5-fpm.sock替换listen = 127.0.0.1:9000(端口号自定义)

2、在/etc/nginx/conf.d目录下,新建站点名配置,如:sitename.conf

3、在sitename.conf加入如下内容:

server {
    listen       80;
    server_name  npesp.com www.npesp.com npesp.cn www.npesp.cn;
    access_log  /var/log/nginx/npesp.access.log;


## Default location
    location / {
        root   /home/www;
        index  index.php;
    }


## Images and static content is treated different
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           30d;
      root /home/www;
    }


## Parse all .php file in the /var/www directory
    location ~ .php$ {
root           /home/www;
                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;
fastcgi_param  SCRIPT_FILENAME  /home/www$fastcgi_script_name;
                include fastcgi_params;
    }


## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }
}

原创粉丝点击