Joomla示例不适用于NGINX与MAMP

问题描述:

我已经在MAMP中使用NGINX在Mac中安装了Joomla 3.6.5并且工作完美,但我还安装了Joomla默认安装过程中的示例演示,并且这些URL不起作用。我还读了documentation about Joomla and NGINX,并将一些更改应用到我的nginx.conf文件中,但它没有修复它。Joomla示例不适用于NGINX与MAMP

这是我的nginx.conf文件位于/应用程序/ MAMP/conf目录/ nginx的目录:

user       myuser staff; 
worker_processes    2; 

events { 
    worker_connections  1024; 
} 

http { 
    include     mime.types; 
    default_type    text/html; 
    gzip on; 

    gzip_comp_level 6; 
    gzip_min_length 1100; 
    gzip_buffers 4 8k; 
    gzip_types    text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; 

    sendfile     on; 
    client_max_body_size 200M; 

    server { 
     listen    7888 default_server; 

     server_name localhost; 
     server_name_in_redirect off; 

     access_log   /Applications/MAMP/logs/nginx_access.log; 
     error_log   /Applications/MAMP/logs/nginx_error.log; 
     # MAMP DOCUMENT_ROOT !! Don't remove this line !! 
     root     "/Applications/MAMP/htdocs"; 
     index index.php index.html index.htm default.html default.htm; 

     location/{ 
      #index   index.html index.php; 
      #try_files $uri $uri/ /index.php?$args; 
      try_files $uri $uri/ /index.php?q=$request_uri; 
     } 

     location ~* /MAMP[^-]*(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   index.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 

     location ~* /phpMyAdmin(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   index.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 

     location ~* /phpPgAdmin(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   index.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 
     # deny running scripts inside writable directories 
     location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { 
       return 403; 
       error_page 403 /403_error.html; 
     } 

     location ~* /phpLiteAdmin(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   index.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 

     location ~* /SQLiteManager(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   index.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 

     location ~* /adminer(.*)$ { 
      root    /Applications/MAMP/bin; 
      index   adminer.php; 

      location ~ \.php$ { 
       try_files  $uri =404; 
       fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
       include   fastcgi_params; 
      } 
     } 

     location /icons { 
      alias /Applications/MAMP/Library/icons; 
      autoindex on; 
     } 

     location /favicon.ico { 
      alias /Applications/MAMP/bin/favicon.ico; 
      # log_not_found off; 
      # access_log off; 
     } 

     location ~ \.php$ { 

      try_files  $uri =404; 
      fastcgi_pass  unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include   fastcgi_params; 
      include fastcgi.conf; 
     } 

     location ~ /\. { 
      deny all; 
     } 
     # caching of files 
     location ~* \.(ico|pdf|flv)$ { 
       expires 1y; 
     } 

     location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { 
       expires 14d; 
     } 
     # location ~* \.(gif|jpg|png|pdf)$ { 
     # expires   30d; 
     # } 

     # location = /robots.txt { 
     # allow all; 
     # log_not_found off; 
     # access_log off; 
     # } 

     # location ~* \.(txt|log)$ { 
     # allow 127.0.0.1; 
     # deny all; 
     # } 

     # location ~ \..*/.*\.php$ { 
     # return 403; 
     # } 

     location /nginx_status { 
      stub_status  on; 
      access_log  off; 
      allow   127.0.0.1; 
      deny    all; 
     } 
    } 

    # HTTPS server 
    # 
    #server { 
    # listen  443 ssl; 
    # server_name localhost; 

    # ssl_certificate  cert.pem; 
    # ssl_certificate_key cert.key; 

    # ssl_session_cache shared:SSL:1m; 
    # ssl_session_timeout 5m; 

    # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    # ssl_ciphers HIGH:!aNULL:!MD5; 
    # ssl_prefer_server_ciphers on; 

    # location/{ 
    #  root html; 
    #  index index.html index.htm; 
    # } 
    #} 
} 

这是我的错误,当我试图访问http://localhost:7888/joomla3/index.php/getting-started

enter image description here

Joomla官方指南不再有效,必须更新。

你遇到的问题恰好是this。实际上,发生的事情是,nginx并没有设置变量的值,这在Joomla核心中是非常依赖的。您在您的nginx.conf中设置PATH_TRANSLATED的值,这反过来会设置$_SERVER['PHP_SELF']的值以解决此问题。

+0

你好兄弟我很抱歉这个答案的晚了,但我住这么bussy这几个月,我试图在MAMP中设置PATH_TRANSLATED编辑我的nginx.conf和我的fastcgi_params再次,但我再次失败,问题仍然存在,所以,可以你解释更多的细节,我该怎么做? – Leo1234562014