如何配置 nginx 和 joomla?网站只加载主页

如何配置 nginx 和 joomla?网站只加载主页

我在 nginx 1.7 服务器 (fastcgi) 中安装了 joomla 3.9.16。当我尝试安装 joomla 时,安装程​​序停止并返回到主页。此外,如果我使用手动安装的 joomla,每个 URL 看起来都很好,但相应的页面不会加载。总是只加载主页。例如: http://f.test/http://f.test/index.php/20-sound/main-sound/separation-22/mp3-with-pointer都返回主页!我根据以下配置了 nginxhttps://docs.joomla.org/Nginx

我的 nginx.con 文件:

events {   
## For a live site, uncomment:
#worker_connections 8096;
}


http {

    server_tokens       off;
sendfile        on;
tcp_nopush      on;
tcp_nodelay     on;
ssi         off;
server_names_hash_bucket_size  64;


## Timeouts ##
##############

client_body_timeout 5;
client_header_timeout   5;
keepalive_timeout   25 25;
send_timeout        15s;
resolver_timeout    3s;

# Timeout period for connection with FastCGI-server. It should be noted that this value can't exceed 75 seconds. 
fastcgi_connect_timeout 5s;

# Amount of time for upstream to wait for a fastcgi process to send data. 
# Change this directive if you have long running fastcgi processes that do not produce output until they have finished processing. 
# If you are seeing an upstream timed out error in the error log, then increase this parameter to something more appropriate. 
fastcgi_read_timeout    40s;

# Request timeout to the server. The timeout is calculated between two write operations, not for the whole request. 
# If no data have been written during this period then serve closes the connection.
fastcgi_send_timeout    15s;


## Buffers ##
#############

fastcgi_buffers         8 32k;
fastcgi_buffer_size     32k;
#fastcgi_busy_buffers_size  256k;
#fastcgi_temp_file_write_size   256k;

open_file_cache         off;

# php max upload limit cannot be larger than this       
client_max_body_size        33m;    

####client_body_buffer_size 1K;
client_header_buffer_size   8k;
large_client_header_buffers 8 16k;
types_hash_max_size     2048;




include nginx.mimetypes.conf;
default_type text/html;




## Logging ##
#############

access_log  "c:/winnmp/log/nginx_access.log";
error_log   "c:/winnmp/log/nginx_error.log" warn;   #debug or warn
log_not_found   on; #enables or disables messages in error_log about files not found on disk. 
rewrite_log off;

fastcgi_intercept_errors off;   # Do Not Change (off) !


gzip  off;

index  index.php index.htm index.html;

server {


    # NEVER ALLOW PUBLIC ACCESS TO THIS SERVER !!!
    # Instead, create projects using WinNMP Manager, and allow public access only to those projects!
    # How to allow access from LAN and Internet to your local project:
    # http://WinNMP.wtriple.com/howtos.php#How-to-allow-access-from-LAN-and-Internet-to-your-local-project

    listen      127.0.0.1:80    default_server;     # Do Not Change ! Security Risk !
    #listen     [::1]:80    ipv6only=on;        # Do Not Change ! Security Risk !
    server_name localhost;              # Do Not Change ! Security Risk !

    # This directive is modified automatically by WinNMP.exe for portability.
    root        "c:/winnmp/www";
    autoindex on;

    allow       127.0.0.1;  # Do Not Change ! Security Risk !
    allow       ::1;        # Do Not Change ! Security Risk !
    deny        all;        # Do Not Change ! Security Risk !

    ## deny access to .htaccess files, if Apache's document root concurs with nginx's one
    location ~ /\.ht {
        deny  all;
    }

    location = /favicon.ico {
            log_not_found off; 
    }
    location = /robots.txt {
            log_not_found off; 
    }


    ## Tools are now served from include/tools/
    location ~ ^/tools/.*\.php$ {                   
        root "c:/winnmp/include";
        try_files $uri =404; 
        include     nginx.fastcgi.conf;
        fastcgi_pass    php_farm;
        allow       127.0.0.1;      # Do Not Change ! Security Risk !
        allow       ::1;            # Do Not Change ! Security Risk !
        deny        all;            # Do Not Change ! Security Risk !
    }
    location ~ ^/tools/ {
        root "c:/winnmp/include";
        allow       127.0.0.1;      # Do Not Change ! Security Risk !
        allow       ::1;            # Do Not Change ! Security Risk !
        deny        all;            # Do Not Change ! Security Risk !
    }


    ## How to add phpMyAdmin 
    ## Copy phpMyAdmin files to c:/winnmp/include/phpMyAdmin then uncomment:

    #location ~ ^/phpMyAdmin/.*\.php$ {
    #   root "c:/winnmp/include";
    #   try_files $uri =404; 
    #   include         nginx.fastcgi.conf;
    #   fastcgi_pass    php_farm;
    #   allow           127.0.0.1;  
    #   allow           ::1;
    #   deny            all;
    #}       
    #location ~ ^/phpMyAdmin/ {
    #   root "c:/winnmp/include";
    #}

    ## Notice that the root directive lacks /phpMyAdmin because Nginx adds the URL path /phpMyAdmin to the root path, so the resulting directory is c:/winnmp/include/phpMyAdmin


    ## PHP for localhost ##
    #######################

    location ~ \.php$ {
        try_files $uri =404; 
        include     nginx.fastcgi.conf;
        include     nginx.redis.conf;
        fastcgi_pass    php_farm;
        allow       127.0.0.1;      # Do Not Change ! Security Risk !
        allow       ::1;            # Do Not Change ! Security Risk !
        deny        all;            # Do Not Change ! Security Risk !
        }

    # How to allow access from LAN and Internet to your local project:
    # http://WinNMP.wtriple.com/howtos.php#How-to-allow-access-from-LAN-and-Internet-to-your-local-project



}



include domains.d/*.conf;


include nginx.phpfarm.conf;






}

我的 f.conf 文件:

  server {
    listen 127.0.0.1:80;
    server_name f.test;
    root    "c:/winnmp/www/f";
    index index.php index.html index.htm default.html default.htm;

    location / {
            try_files $uri $uri/ /index.php?$args;
    }



    location ~ \.php$ {                       
        include     nginx.fastcgi.conf;
        include     nginx.redis.conf;
        fastcgi_pass    php_farm;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }


 }

相关内容