VPS侦探论坛

 找回密码
 注册
查看: 5787|回复: 3

joomla3.2 nginx下伪静态 404错误

[复制链接]
发表于 2015-1-22 21:59:27 | 显示全部楼层 |阅读模式

在joomla 官网上下载了nginx 伪静态规则,修改了文件
  1. /usr/local/nginx/conf/vhost/xxx.conf
复制代码

重启nginx 后 除开网站首页其他页面都是404错误。
  1. https://docs.joomla.org/Nginx
复制代码


  1. server {
  2. listen 80;
  3. server_name YOUR_DOMAIN;
  4. server_name_in_redirect off;

  5. access_log /var/log/nginx/localhost.access_log main;
  6. error_log /var/log/nginx/localhost.error_log info;

  7. root PATH_ON_SERVER;
  8. index index.php index.html index.htm default.html default.htm;
  9. # Support Clean (aka Search Engine Friendly) URLs
  10. location / {
  11. try_files $uri $uri/ /index.php$args;
  12. }

  13. # deny running scripts inside writable directories
  14. location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
  15. return 403;
  16. error_page 403 /403_error.html;
  17. }

  18. location ~ \.php$ {
  19. fastcgi_pass 127.0.0.1:9000;
  20. fastcgi_index index.php;
  21. include fastcgi_params;
  22. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  23. include /etc/nginx/fastcgi.conf;
  24. }

  25. # caching of files
  26. location ~* \.(ico|pdf|flv)$ {
  27. expires 1y;
  28. }

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

  32. }
复制代码





请各位看下规则是否有问题
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-1-23 08:39:53 | 显示全部楼层


他们官网给你的是一个完整的虚拟主机配置,你看一下配置里的注释就明白了
# Support Clean (aka Search Engine Friendly) URLs
开始是伪静态
# deny running scripts inside writable directories
开始是一些可执行文件的屏蔽
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2015-1-23 15:12:59 | 显示全部楼层

是不是只要这一段就可以了呢?

  1. root PATH_ON_SERVER;
  2. index index.php index.html index.htm default.html default.htm;
  3. # Support Clean (aka Search Engine Friendly) URLs
  4. location / {
  5. try_files $uri $uri/ /index.php$args;
  6. }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-1-23 20:28:39 | 显示全部楼层



# Support Clean (aka Search Engine Friendly) URLs下面的

#2应该说的很清楚了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-5-17 12:53 , Processed in 0.026719 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表