使用 WURFL 将 Apache WP 转换为 Nginx

Converting Apache WP to Nginx with WURFL

我在尝试将在 apache 上运行的项目转换为 nginx 时遇到一些问题。我的其余设置似乎没问题,因为 index.php 是 运行,但是当它到达 WURFL 目录时出错,我将在一分钟内显示。

有没有人有这方面的经验?我无法在 SO 上找到任何类似的示例,也无法通过常规 google 搜索找到对我有帮助的示例。

nginx.conf

worker_processes  1;

error_log  /usr/local/var/log/nginx/nginx_error.log  warn;

events {
    worker_connections  256;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    wurfl_enable    on;
    wurfl_root /Library/WebServer/Documents/WURFL/;

    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

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

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

    include servers/*;
}

servers/bingo

server {
    listen 80;

    server_name jock.bingo;

    root /Library/WebServer/Documents/superfreebingo.com;
    index index.php;

    access_log /usr/local/var/log/nginx/testaccess.log;
    error_log /usr/local/var/log/nginx/testerror.log;

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

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass localhost:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param APP_ENV /Library/WebServer/Documents/WURFL;
        fastcgi_param wurfl_dir "/Library/WebServer/Documents/WURFL/";
        fastcgi_param wurfl_resource_dir "/Library/WebServer/Documents/WURFL/examples/";
    }
}

我的错误信息

Fatal error: Uncaught exception 'WURFL_Storage_Exception' with message 'The file storage directory is not writeable: /Library/WebServer/Documents/WURFL/examples/resources/storage/persistence/wurfl_1711' in /Library/WebServer/Documents/WURFL/WURFL/Storage/File.php:59 Stack trace: #0 /Library/WebServer/Documents/WURFL/WURFL/Storage/File.php(47): WURFL_Storage_File->createRootDirIfNotExist() #1 /Library/WebServer/Documents/WURFL/WURFL/Storage/File.php(39): WURFL_Storage_File->initialize(Array) #2 /Library/WebServer/Documents/WURFL/WURFL/Storage/Factory.php(42): WURFL_Storage_File->__construct(Array) #3 /Library/WebServer/Documents/WURFL/WURFL/WURFLManagerFactory.php(60): WURFL_Storage_Factory::create(Array) #4 /Library/WebServer/Documents/superfreebingo.com/wp-device-redirect.php(46): WURFL_WURFLManagerFactory->__construct(Object(WURFL_Configuration_InMemoryConfig))

5 /Library/WebServer/Documents/superfreebingo.com/wp-subid.php(47): getDevice() #6

/Library/WebServer/Documents/superfreebingo.com/index.php(19): require('/Libr in /Library/WebServer/Documents/WURFL/WURFL/Storage/File.php on line 59

还没有人回答,但我实际上找到了解决方案,而不是删除我认为我 post 我做了什么来解决它的问题,以供将来遇到此问题的开发人员使用。

这只是一个文件权限问题。我导航到 WURFL 目录中指定的位置:

/Library/WebServer/Documents/WURFL/examples/resources/storage/persistence

然后运行递归文件权限编辑:

sudo chmod -R 666 wurfl_1711

之后我重新加载了该网站,但它对另一个文件夹给出了相同的错误,所以我导航到那个文件夹并再次执行。

希望这对某人有所帮助!