树莓派nginx关于运行PHP网页的配置文件

由于NGINX本身并不具备运行PHP网页的能力,因此需要配合PHP程序来解释网页。在树莓派中添加配置文件/etc/nginx/conf.d/***.conf

打开此文件

server { listen 82; ========此处为自定义端口 root /var/www/html/admin; ========>此处为网页文件文件夹 # Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # pass PHP scripts to FastCGI server # location ~ \.php$ { ★★★ # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; ★★★ fastcgi_index index.php; ★★★ include fastcgi_params; ★★★ # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; } ★★★ # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #}

将图中几处五角星处的注释去掉。然后保存文件,重启nginx服务。

评论

此博客中的热门博文

aria2 下载时出现errorcode=19 name resolution failed错误的解决办法

KODI(XMBC)安装中文字幕插件

CENTOS 7搭建Resilio-sync 官方指导步骤