2013-09-23 4 views
0

проблема решенаустановить WordPress в OSX с Nginx и PHP не удалось

Я хочу установить WordPress OSX.

Это то, что я сделал.

  1. $ brew install nginx
  2. $ brew install --without-apache --with-fpm --with-mysql php55
  3. скачать последние wordpress.zip и извлечение в/вар/WWW/wordpress_test
  4. запуска PHP-FPM по php-fpm -g /usr/local/var/run/php-fpm.pid
  5. записи Nginx конфигурационных файлов, как это.

/usr/local/etc/nginx/nginx.conf

worker_processes 1; 

error_log /usr/local/log/nginx/error.log; 
pid  /usr/local/var/run/nginx.pid; 

events { 
    worker_connections 256; 
} 

http { 
    include  /usr/local/etc/nginx/mime.types; 
    default_type application/octet-stream; 

    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 /usr/local/log/nginx/access.log main; 

    sendfile  on; 

    keepalive_timeout 65; 

    #gzip on; 
    include /usr/local/etc/nginx/site-enabled/*; 
} 

/USR/местные/и т.д./Nginx/сайт-доклада доступен/wordpress_test

server { 
    listen  8080; 
    server_name localhost; 

    access_log /usr/local/log/nginx/wordpress_test.access.log; 
    error_log /usr/local/log/nginx/wordpress_test.error.log; 

    root /var/www/wordpress_test; 
    index index.html index.htm index.php; 

    #error_page 404    /404.html; 

    # redirect server error pages to the static page /50x.html 
    # 
    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
     root html; 
    } 
    location ~ \.php$ { 
     include fastcgi.conf; 
     fastcgi_intercept_errors on; 
     fastcgi_pass 127.0.0.1:9000; 
    } 

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 
     expires max; 
     log_not_found off; 
    } 

    location ~ /\.ht { 
     deny all; 
    } 
} 
  1. создать линке /usr/local/nginx/site-available/wordpress_test в `usr/local/nginx/site-enabled/wordpress_test
  2. создать /var/www/wordpress_test/info.php и написать внутри него <?php phpinfo(); ?>.

И я могу видеть информацию о php, обращаясь к http://localhost:8080/info.php. Но я получаю сообщение об ошибке при доступе http://localhost:8080/index.php.

/usr/local/log/nginx/wordpress_test.error.log не положено сообщение. и /usr/local/log/nginx/wordpress_test.access.log показывает это сообщение.

127.0.0.1 - - [23/Sep/2013:17:21:55 +0900] "GET /index.php HTTP/1.1" 500 537 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36" 

Как я могу решить эту проблему? Что я должен проверить дальше?

- Я добавляю настройки, подобные этому, от http://codex.wordpress.org/Nginx, затем он работает.

# WordPress single blog rules. 
# Designed to be included in any server {} block. 

# This order might seem weird - this is attempted to match last if rules below fail. 
# http://wiki.nginx.org/HttpCoreModule 
location/{ 
    try_files $uri $uri/ /index.php?$args; 
} 

# Add trailing slash to */wp-admin requests. 
rewrite /wp-admin$ $scheme://$host$uri/ permanent; 

# Directives to send expires headers and turn off 404 error logging. 
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { 
     access_log off; log_not_found off; expires max; 
} 

# Uncomment one of the lines below for the appropriate caching plugin (if used). 
#include global/wordpress-wp-super-cache.conf; 
#include global/wordpress-w3-total-cache.conf; 

# Pass all .php files onto a php-fpm/php-fcgi server. 
location ~ \.php$ { 
    # Zero-day exploit defense. 
    # http://forum.nginx.org/read.php?2,88845,page=3 
    # Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi. 
    # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked. 
    try_files $uri =404; 

    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 

    include fastcgi_params; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
# fastcgi_intercept_errors on; 
    fastcgi_pass php; 
} 

ответ

0

Это, кажется, ваш файл .htaccess не работает с Nginx, Вы конвертируется на WordPress .htaccess файл Nginx конфигурации?

Пожалуйста, смотрите URL-адрес http://winginx.com/htaccess для .htaccess для конвертера nginx conf.

0

просто добавить новое местоположение в /usr/local/etc/nginx/site-avaiable/wordpress_test

location/{ 
    try_files $uri /index.php$request_uri; 
} 
+0

Спасибо за ответ. Я добавляю настройку и делаю 'nginx -s reload'. но он пока не работает. – ironsand

+0

Вы назвали его sudo? –

+0

Нет, в osx мне это не нужно. Когда я редактировал вопрос, я решил проблему. Но все равно спасибо! – ironsand

Смежные вопросы