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

Magento 2 Error CentOS Nginx-PHP-FPM

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
9 posts • Page 1 of 1
alikamran
Posts: 16
Joined: Tue May 03, 2016 10:54 am

Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by alikamran » Wed Jan 24, 2018 8:51 am

Hey guys,
I am trying for the past couple of days to get Magneto 2 work on my server but no luck. I was running Magento 1.9 before but now I want to move my websites to Magento 2.2.

I have copied the files, set the file permissions and nginx configuration but no avail. I get HTTP 500 error.

I have used magento template available in VestaCP, Magento 2's sample nginx and a few other nginx configs available online but nothing is working.

Its a fresh installation so when I open the URL it should run the setup for Magento. If anyone is using Magento with nginx-php-fpm then can you please share your config file with me?
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by mehargags » Wed Jan 24, 2018 4:54 pm

Pls paste your nginx conf file from /home/<vesta-user>/conf/web
Top

alikamran
Posts: 16
Joined: Tue May 03, 2016 10:54 am

Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by alikamran » Thu Jan 25, 2018 6:13 am

This is my config:
SpoilerShow
server {
listen 139.59.243.53:80;
server_name anayaonline.com www.anayaonline.com;
root /home/admin/web/anayaonline.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/anayaonline.com.log combined;
access_log /var/log/nginx/domains/anayaonline.com.bytes bytes;
error_log /var/log/nginx/domains/anayaonline.com.error.log error;

rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
allow all;
log_not_found off;
access_log off;
}

# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}

location ~ \..*/.*\.php$ {
return 403;
}

# No no for private
location ~ ^/sites/.*/private/ {
return 403;
}
return 403;
}

# Block access to "hidden" files and directories whose names begin with a
# period. This includes directories used by version control systems such
# as Subversion or Git to store control files.
location ~ (^|/)\. {
return 403;
}

location / {
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;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}

fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
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/admin/web/anayaonline.com/document_errors/;
}
alias /home/admin/web/anayaonline.com/document_errors/;
}

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

location /vstats/ {
alias /home/admin/web/anayaonline.com/stats/;
include /home/admin/conf/web/anayaonline.com.auth*;
}

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

include /home/admin/conf/web/nginx.anayaonline.com.conf*;
}
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by mehargags » Thu Jan 25, 2018 6:59 am

# Put on TOP before SERVER block

Code: Select all

	#-----Magento-------------
	upstream fastcgi_backend {
		   #server  unix:/run/php/php7.0-fpm.sock;
			server	127.0.0.1:9001;
	}
	#-----/ Magento------------- 
# Put after "server name" directive

Code: Select all

	#-----Magento-------------
			set $MAGE_ROOT /home/<user>/web/<domain>/public_html;
			set $MAGE_MODE developer;
			include /home/<user>/web/<domain>/public_html/nginx.conf.sample;
	#-----/ Magento-------------   


Make sure the sample magento file is there in your path and you replace <user> & <domain> with your username & domain
/home/<user>/web/<domain>/public_html/nginx.conf.sample
Top

alikamran
Posts: 16
Joined: Tue May 03, 2016 10:54 am

Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by alikamran » Thu Jan 25, 2018 10:47 am

Thank you. I did the changes but still no luck.

I have checked the nginx config and ran the nginx -t test as well. Everything seems fine but still giving HTTP 500 error.

I updated PHP to 7.0.2. Checked all the file permissions as per Magento documentation but its still not working :(
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by mehargags » Thu Jan 25, 2018 1:58 pm

Grow up man... is this how you will be managing your server ? Sitting dud on that 500 error ??
Paste your nginx domain logs, check Magento's exception log. No one can spoon-feed you if you can't even understand the basics of server administration.
Top

alikamran
Posts: 16
Joined: Tue May 03, 2016 10:54 am

Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by alikamran » Thu Jan 25, 2018 5:58 pm

Easy there man. Got it working, it was an issue with PHP settings.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by mehargags » Thu Jan 25, 2018 7:40 pm

And once you fixed, you do not have the courtesy to atleast share the actual fix with the community ? how good!!
Top

alikamran
Posts: 16
Joined: Tue May 03, 2016 10:54 am

Re: Magento 2 Error CentOS Nginx-PHP-FPM
  • Quote

Post by alikamran » Sat Jan 27, 2018 5:14 am

I am sorry I forgot. Anyways here is the fix:

I updated the PHP but it didn't update properly. 3 extensions were not working encrypt, soap and zip. So I had to rebuild the server and everything and updated the pho through this link:

https://vpsguide.net/tutorials/vps-tuto ... 71-centos/

This updated the pho properly. And make sure you clean the old pho as well. Otherwise it will cause issues.
Top


Post Reply
  • Print view

9 posts • Page 1 of 1

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
 

 

cron

Login  •  Register

I forgot my password