1、在nginx主配置文件nginx.conf的http模块下引入配置文件夹(注意路径的正确性)
http {
include /usr/local/nginx/conf/conf.d/*.conf;
#这里就是引入的子配置文件夹
}
2、在引入的配置文件夹中添加配置文件*.conf,内容如下方示例:
server
{
listen 80;#监听端口
server_name localhost;#域名
index index.html index.htm index.php;
root /opt/html;#站点目录
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$
{
expires 30d;
# access_log off;
}
location ~ .*\.(js|css)?$
{
expires 15d;
# access_log off;
}
access_log off;
}
标签:index,配置文件,创建,nginx,conf,php,fastcgi From: https://www.cnblogs.com/brad93/p/16647499.html