Open taikulawo opened 4 years ago
每一个 server 都是一个虚拟主机,通过 http 的 host 字段区分不同的目录
server
http
host
这个 host 字段对应着nginx的server_name
nginx
server_name
oneindex需要 php-fpm 来处理请求,php-fpm 默认使用unix socket,需要在 /etc/php/7.0/fpm/pool.d/下的配置文件中添加
oneindex
php-fpm
unix socket
/etc/php/7.0/fpm/pool.d/
listen = 127.0.0.1:9000 listen = /run/php/php7.0-fpm.sock
使得 php-fpm 监听 9000 端口
9000
nginx根目录为 /var/www/html,我将 oneindex 放在了 /var/www/html/oneindex
/var/www/html
/var/www/html/oneindex
如下为配置文件
server { listen 80; # 指定我使用的域名 server_name drive.chaochaogege.com; index index.php; # 虚拟主机的根目录 root /var/www/html/oneindex; location / { index index.html; #Implementing PHP pseudo static try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_pass localhost:9000; fastcgi_index index.php; include fastcgi_params; #document_root 与上面的root相当,指的是请求的根目录 fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; # fastcgi_param QUERY_STRING $query_string; } }
每一个
server
都是一个虚拟主机,通过http
的host
字段区分不同的目录这个
host
字段对应着nginx
的server_name
oneindex
需要php-fpm
来处理请求,php-fpm
默认使用unix socket
,需要在/etc/php/7.0/fpm/pool.d/
下的配置文件中添加使得
php-fpm
监听9000
端口nginx根目录为
/var/www/html
,我将oneindex
放在了/var/www/html/oneindex
如下为配置文件