server {
listen 80;
server_name localhost;
index index.php index.html index.shtml index.htm;
root /service/nginx/html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php)?$
{
expires -1s;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/phpfpm.sock;
#php-fpm.conf listen = /var/run/phpfpm.sock##
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
[root@lnmp conf]# /service/nginx/sbin/nginx -t
nginx: the configuration file /service/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /service/nginx/conf/nginx.conf test is successful
启动nginx
[root@lnmp conf]# /service/nginx/sbin/nginx
[root@lnmp conf]# netstat -lanp|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9867/nginx
unix 3 [ ] STREAM CONNECTED 465408 9867/nginx
unix 3 [ ] STREAM CONNECTED 465407 9867/nginx
推荐阅读:
Nginx做负载均衡报:nginx: [emerg] could not build the types_hash
Nginx 负载均衡模块 ngx_http_upstream_module 详述
Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器
Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建)
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
相关资讯 Nginx安装
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯