php files downloading instead of executing nginx

cn flag

I am working on a project for a school assignment. We have to make a webserver with wordpress on it.

There are some stuff we had to change think of changing the user of nginx and mariadb to webuser and dbuser. This is so we gain experience in linux.

I need to install wordpress on the webserver, however php files are not executing on the website. html files do work.

I've googled all day, asked my teacher but he said look on google lol.

Please help.

Here is the nginx config:

# For more information on configuration, see:
#   * Official English Documentation:
#   * Official Russian Documentation:

user webuser;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See
    # for more information.
    include /etc/nginx/conf.d/*.conf;

server {
        listen 80;
        server_name localhost;

        access_log /Website/logs/access.log;
        error_log /Website/logs/error.log;

location / {
        root /Website;
        index index.php index.html index.htm;

if (-f $request_filename) {
        expires 30d;

if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php?q=$1 last;

location ~ .php$ {
        fastcgi_pass   localhost:9000;  # port where FastCGI processes were spawned
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   /Website/$fastcgi_script_name;  # same path as above
        fastcgi_param PATH_INFO               $fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
in flag
Questions on Server Fault must be about managing information technology systems in a **business environment**. Voting to close the question as off topic.
Appleoddity avatar
ng flag
You should take this over to [su].

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.