nginx默认虚拟主机
2016-07-14 07:50
477 查看
server
{
listen 80 default_server;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
deny all;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
再输入location ~ \.php$ { 红色标记的地方为输入空格,提示错误,查看很久感觉没有问题,最后才发现少了一个空格。报错信息如下:
directive "location" has no opening "{" in /usr/local/nginx//conf/vhosts/default.conf:10
另外nginx的配置每一行都需要加上分号结束。
{
listen 80 default_server;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
deny all;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
再输入location ~ \.php$ { 红色标记的地方为输入空格,提示错误,查看很久感觉没有问题,最后才发现少了一个空格。报错信息如下:
directive "location" has no opening "{" in /usr/local/nginx//conf/vhosts/default.conf:10
另外nginx的配置每一行都需要加上分号结束。
相关文章推荐
- nginx目录列表和目录访问权限设置
- nginx设置目录浏览及中文乱码问题解决方案
- 使用apache和nginx部署graphite的相关配置
- 在Windows下搭建基于nginx的视频直播和点播系统
- Nginx配置文件nginx.conf中文详解(总结)
- Linux(Centos)之安装Nginx及注意事项
- Nginx配置文件nginx.conf中文详解
- FastDFS + Nginx module
- Nginx配置两份日志记录
- nginx学习笔记
- 教你编译PHP7 (nginx+mysql+php7)
- Nginx+php-fpm 502 504问题
- nginx支持pathinfo模式
- 使用nginx-rtmp搭建视频直播服务器
- 详解Nginx中基本的内存池初始化配置
- 解析Nginx中的日志模块及日志基本的初始化和过滤配置
- Nginx源码分析 - 主流程篇 - 模块的初始化
- nginx 编译安装
- Nginx获取自定义头部header的值
- nginx如何设置自定义404页面