F
F
fedorenko_k2016-03-22 17:27:23
PHP
fedorenko_k, 2016-03-22 17:27:23

nginx setup?

Hello. I wrote a config for Apache for the site, but I use nginx (I can’t do it for it).

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([0-9]+)/([a-z_A-Z_0-9\-]+).html$ /content.php?id=$1&key_en=$2 [L]
RewriteRule ^sitemap.xml$ /sitemap.php [L]
RewriteRule ^robots.txt$ /script/robots.php [L]

Whatever I do with the nginx config, it gives me everything as files with PHP code.
server {
  server_name site.ru www.site.ru;
  charset off;
  disable_symlinks if_not_owner from=$root_path;
  index index.php;
  root $root_path;
  set $root_path /var/www/gamepost/data/www/site.ru;
  access_log /var/www/httpd-logs/site.ru.access.log ;
  error_log /var/www/httpd-logs/site.ru.error.log notice;
  listen IP:80;
  include /etc/nginx/vhosts-includes/*.conf;
  location / {
    if (!-e $request_filename){ rewrite ^/([0-9]+)/([a-z_A-Z_0-9\-]+).html$ /content.php?id=$1&key_en=$2 break; }
    
  }

  location = /sitemap.xml {
    rewrite ^(.*)$ /sitemap.php break;
  }
  location = /robots.txt {
    rewrite ^(.*)$ /script/robots.php break;
  }

  location   ~ \.php$ {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass unix:/var/www/php-fpm/ggh.sock;
    try_files $uri =404;
    include fastcgi_params;
  }
  ssi on;
}

Tell someone please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
O. J, 2016-03-24
@OrlovEvgeny

is php-fpm worth it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question