cancel
Showing results for 
Search instead for 
Did you mean: 

Howto install Magento 2 on Plesk with Nginx?

Howto install Magento 2 on Plesk with Nginx?

I'm trying to setup Magento 2 on Plesk with Nginx. I've copied "nginx.conf.sample" to "nginx.conf" in my "httpdocs" directory.

 

Second, I've changed settings under "Apache & Nginx settings" in Plesk like I've found on different forums;

* Disabled "Proxy mode"

* Inserted in "Additional nginx directives" different codes, but none of them work;

server {
   listen 80;
   server_name domain.name;
   set $MAGE_ROOT /var/www/vhosts/domain.name/httpdocs;
   include /var/www/vhosts/domain.name/httpdocs/nginx.conf;
}

Error: Invalid nginx configuration: nginx: [emerg] "server" directive is not allowed here in /var/www/vhosts/system/domain.name/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

 

include /var/www/vhosts/domain.name/httpdocs/nginx.conf;

Error: Invalid nginx configuration: nginx: [emerg] no port in upstream "fastcgi_backend" in /var/www/vhosts/domain.name/httpdocs/nginx.conf:41 nginx: configuration file /etc/nginx/nginx.conf test failed

 

upstream fastcgi_backend {  
    server unix:/var/run/php/php7.0-fpm.sock;
}

server {  
    listen 443 ssl;
    server_name domain.name;
    set $MAGE_ROOT /var/www/vhosts/domain.name/httpdocs;
    set $MAGE_MODE default;
    include /var/www/vhosts/domain.name/nginx.conf;
}

server {  
    listen 80;
    server_name domain.name;
    set $MAGE_ROOT /var/www/vhosts/domain.name/httpdocs;
    set $MAGE_MODE default;
    include /var/www/vhosts/domain.name/httpdocs/nginx.conf;
}

Error: Invalid nginx configuration: nginx: [emerg] "upstream" directive is not allowed here in /var/www/vhosts/system/domain.name/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

 

Does someone know how to set it up?

2 REPLIES

Re: Howto install Magento 2 on Plesk with Nginx?

Apparently not eh?

 

I have been trying to get it to run on CentOS7 with nginx. I can get the install to work without errors but all I get is the nginx test page when I try to access it in a browser. Can't seem to find an answer in the forums either. It shouldn't be this hard, I'm about to try something else.

Re: Howto install Magento 2 on Plesk with Nginx?

Plesk have vhost templates, you need to create some custom templates for magento. then restart nginx.

------------
MagenX - Magento and Server optimization