Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

nginx + php-fpm + magento

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
12 posts
  • 1
  • 2
  • Next
kaines
Posts: 10
Joined: Tue Dec 01, 2015 9:37 pm

nginx + php-fpm + magento
  • Quote

Post by kaines » Mon Aug 08, 2016 12:08 pm

hi,

ive installed vestacp with nginx + php fpm. When i moved an old magento (1.9) website to this new vestacp server erverything works fine, the website opens, but when i click on a menu i get 404 not found in url i see domain.com/index.php/submenutitle and as i see the issue is with index.php

do i need to fix something in nginx config? (i use default magento config)

thanks for the answer
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx + php-fpm + magento
  • Quote

Post by SS88 » Tue Aug 09, 2016 5:45 am

There is no magento Web Template? Do you have one? I did a fresh install and don't see one?
Top

kaines
Posts: 10
Joined: Tue Dec 01, 2015 9:37 pm

Re: nginx + php-fpm + magento
  • Quote

Post by kaines » Tue Aug 09, 2016 6:29 am

No i dont have magento template... and i think there is an issue in configuration, does maybe staff know know to do it?
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx + php-fpm + magento
  • Quote

Post by SS88 » Tue Aug 09, 2016 6:33 am

kaines wrote:No i dont have magento template... and i think there is an issue in configuration, does maybe staff know know to do it?
Magento needs a custom nginx configuration file just like WordPress does. What web template are you using? Perhaps "wordpress2" may work for you?
Top

kaines
Posts: 10
Joined: Tue Dec 01, 2015 9:37 pm

Re: nginx + php-fpm + magento
  • Quote

Post by kaines » Tue Aug 09, 2016 7:14 am

strnage is, if i choose other template it doesnt take it, and when i try the configuration file with nginx -t i get:

nginx: [emerg] "location" directive is not allowed here in /home/USERNAME/conf/web/nginx.conf:48
nginx: configuration file /etc/nginx/nginx.conf test failed
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx + php-fpm + magento
  • Quote

Post by SS88 » Tue Aug 09, 2016 7:17 am

kaines wrote:strnage is, if i choose other template it doesnt take it, and when i try the configuration file with nginx -t i get:

nginx: [emerg] "location" directive is not allowed here in /home/USERNAME/conf/web/nginx.conf:48
nginx: configuration file /etc/nginx/nginx.conf test failed
Without known what's in the file /home/USERNAME/conf/web/nginx.conf it's hard to help you.

It may be duplicate lines? nginx has nothing to do with Magento, etc so if nginx fails here it's a config error.
Top

kaines
Posts: 10
Joined: Tue Dec 01, 2015 9:37 pm

Re: nginx + php-fpm + magento
  • Quote

Post by kaines » Tue Aug 09, 2016 7:35 am

i have rebuilded the whole user and now templates work ok, but magento with index.php still doesnt work, ive tryed all templates.
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx + php-fpm + magento
  • Quote

Post by SS88 » Tue Aug 09, 2016 7:44 am

kaines wrote:i have rebuilded the whole user and now templates work ok, but magento with index.php still doesnt work, ive tryed all templates.
Paste the contents of nginx.conf
Top

kaines
Posts: 10
Joined: Tue Dec 01, 2015 9:37 pm

Re: nginx + php-fpm + magento
  • Quote

Post by kaines » Tue Aug 09, 2016 7:47 am

This is the template for wordpress
server {
listen IP:8082;
server_name user.mydomain.com http://www.user.mydomain.com;
root /home/myusername/web/user.mydomain.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/user.mydomain.com.log combined;
access_log /var/log/nginx/domains/user.mydomain.com.bytes bytes;
error_log /var/log/nginx/domains/user.mydomain.com.error.log error;

location / {
rewrite "^/page/([0-9]+)(/?)$" /index.php?cstart=$1 last;

rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),([0-9]+),(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&cstart=$5&news_name=$6&seourl=$6 last;
rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page,([0-9]+),(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5&seourl=$5 last;
rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/print:page,([0-9]+),(.*).html(/?)+$" /engine/print.php?subaction=showfull&year=$1&month=$2&day=$3&news_page=$4&news_name=$5&seourl=$5 last;
rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*).html(/?)+$" /index.php?subaction=showfull&year=$1&month=$2&day=$3&news_name=$4&seourl=$4 last;

rewrite "^/([^.]+)/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$4&news_page=$2&cstart=$3&seourl=$5&seocat=$1 last;
rewrite "^/([^.]+)/page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$3&news_page=$2&seourl=$4&seocat=$1 last;
rewrite "^/([^.]+)/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /engine/print.php?news_page=$2&newsid=$3&seourl=$4&seocat=$1 last;
rewrite "^/([^.]+)/([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$2&seourl=$3&seocat=$1 last;

rewrite "^/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$3&news_page=$1&cstart=$2&seourl=$4 last;
rewrite "^/page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$2&news_page=$1&seourl=$3 last;
rewrite "^/print:page,([0-9]+),([0-9]+)-(.*).html(/?)+$" /engine/print.php?news_page=$1&newsid=$2&seourl=$3 last;
rewrite "^/([0-9]+)-(.*).html(/?)+$" /index.php?newsid=$1&seourl=$2 last;

rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})(/?)+$" /index.php?year=$1&month=$2&day=$3 last;
rewrite "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)(/?)+$" /index.php?year=$1&month=$2&day=$3&cstart=$4 last;

rewrite "^/([0-9]{4})/([0-9]{2})(/?)+$" /index.php?year=$1&month=$2 last;
rewrite "^/([0-9]{4})/([0-9]{2})/page/([0-9]+)(/?)+$" /index.php?year=$1&month=$2&cstart=$3 last;

rewrite "^/([0-9]{4})(/?)+$" /index.php?year=$1 last;
rewrite "^/([0-9]{4})/page/([0-9]+)(/?)+$" /index.php?year=$1&cstart=$2 last;

rewrite "^/tags/([^/]*)(/?)+$" /index.php?do=tags&tag=$1 last;
rewrite "^/tags/([^/]*)/page/([0-9]+)(/?)+$" /index.php?do=tags&tag=$1&cstart=$2 last;

rewrite "^/xfsearch/([^/]*)(/?)+$" /index.php?do=xfsearch&xf=$1 last;
rewrite "^/xfsearch/([^/]*)/page/([0-9]+)(/?)+$" /index.php?do=xfsearch&xf=$1&cstart=$2 last;

rewrite "^/user/([^/]*)/rss.xml$" /engine/rss.php?subaction=allnews&user=$1 last;
rewrite "^/user/([^/]*)(/?)+$" /index.php?subaction=userinfo&user=$1 last;
rewrite "^/user/([^/]*)/page/([0-9]+)(/?)+$" /index.php?subaction=userinfo&user=$1&cstart=$2 last;
rewrite "^/user/([^/]*)/news(/?)+$" /index.php?subaction=allnews&user=$1 last;
rewrite "^/user/([^/]*)/news/page/([0-9]+)(/?)+$" /index.php?subaction=allnews&user=$1&cstart=$2 last;
rewrite "^/user/([^/]*)/news/rss.xml(/?)+$" /engine/rss.php?subaction=allnews&user=$1 last;

rewrite "^/lastnews(/?)+$" /index.php?do=lastnews last;
rewrite "^/lastnews/page/([0-9]+)(/?)+$" /index.php?do=lastnews&cstart=$1 last;

rewrite "^/catalog/([^/]*)/rss.xml$" /engine/rss.php?catalog=$1 last;
rewrite "^/catalog/([^/]*)(/?)+$" /index.php?catalog=$1 last;
rewrite "^/catalog/([^/]*)/page/([0-9]+)(/?)+$" /index.php?catalog=$1&cstart=$2 last;

rewrite "^/newposts(/?)+$" /index.php?subaction=newposts last;
rewrite "^/newposts/page/([0-9]+)(/?)+$" /index.php?subaction=newposts&cstart=$1 last;

rewrite "^/favorites(/?)+$" /index.php?do=favorites last;
rewrite "^/favorites/page/([0-9]+)(/?)+$" /index.php?do=favorites&cstart=$1 last;

rewrite "^/rules.html$" /index.php?do=rules last;
rewrite "^/statistics.html$" /index.php?do=stats last;
rewrite "^/addnews.html$" /index.php?do=addnews last;
rewrite "^/rss.xml$" /engine/rss.php last;
rewrite "^/sitemap.xml$" /uploads/sitemap.xml last;

if (!-d $request_filename) {
rewrite "^/([^.]+)/page/([0-9]+)(/?)+$" /index.php?do=cat&category=$1&cstart=$2 last;
rewrite "^/([^.]+)/?$" /index.php?do=cat&category=$1 last;
}

if (!-f $request_filename) {
rewrite "^/([^.]+)/rss.xml$" /engine/rss.php?do=cat&category=$1 last;
rewrite "^/page,([0-9]+),([^/]+).html$" /index.php?do=static&page=$2&news_page=$1 last;
rewrite "^/print:([^/]+).html$" /engine/print.php?do=static&page=$1 last;
}

if (!-f $request_filename) {
rewrite "^/([^/]+).html$" /index.php?do=static&page=$1 last;
}

location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}

location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}

fastcgi_pass 127.0.0.1:9004;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}

error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;

location /error/ {
alias /home/myusername/web/user.mydomain.com/document_errors/;
}

location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}

include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;

include /home/myusername/conf/web/nginx.user.mydomain.com.conf*;
}
Last edited by kaines on Tue Aug 09, 2016 7:57 am, edited 1 time in total.
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: nginx + php-fpm + magento
  • Quote

Post by SS88 » Tue Aug 09, 2016 7:51 am

lol.

That's not a standard nginx configuraton file - that's heavily customised. Do you even know what half of that stuff is?
Top


Post Reply
  • Print view

12 posts
  • 1
  • 2
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password