We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Magento 2 Error CentOS Nginx-PHP-FPM
Magento 2 Error CentOS Nginx-PHP-FPM
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?
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?
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
Pls paste your nginx conf file from /home/<vesta-user>/conf/web
Re: Magento 2 Error CentOS Nginx-PHP-FPM
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*;
}
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*;
}
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
# Put on TOP before SERVER block
# Put after "server name" directive
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
Code: Select all
#-----Magento-------------
upstream fastcgi_backend {
#server unix:/run/php/php7.0-fpm.sock;
server 127.0.0.1:9001;
}
#-----/ Magento-------------
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
Re: Magento 2 Error CentOS Nginx-PHP-FPM
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 :(
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 :(
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
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.
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.
Re: Magento 2 Error CentOS Nginx-PHP-FPM
Easy there man. Got it working, it was an issue with PHP settings.
-
- Support team
- Posts: 1096
- Joined: Sat Sep 06, 2014 9:58 pm
- Contact:
- Os: Debian 8x
- Web: apache + nginx
Re: Magento 2 Error CentOS Nginx-PHP-FPM
And once you fixed, you do not have the courtesy to atleast share the actual fix with the community ? how good!!
Re: Magento 2 Error CentOS Nginx-PHP-FPM
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.
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.