5

enter image description hereMy actions: I install only: nginx 1.10.1, php7 and mysql 5.6 on ubuntu 14.04. php install: sudo apt-get install -y php7.0-fpm php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv php7.0-opcache php7.0-soap php7.0-json php7.0-xml I copy sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/agestor.com. In agestor.com paste:

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

server {  
    listen 443 ssl;
    server_name agestor.com;
    set $MAGE_ROOT /var/www/agestor.com/html;
    set $MAGE_MODE default;
    include /var/www/agestor.com/html/nginx.conf.sample;
}

server {  
    listen 80;
    server_name agestor.com;
    set $MAGE_ROOT /var/www/agestor.com/html;
    set $MAGE_MODE default;
    include /var/www/agestor.com/html/nginx.conf.sample;
}  

And include him: sudo ln -s /etc/nginx/sites-available/agestor.com /etc/nginx/sites-enabled/ But not install magento 2.

sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

error.log: 2016/06/21 14:21:35 [error] 13909#13909: *46 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 37.146.123.141, server: agestor.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "www.agestor.com" I set up my VPS on this article: magento 2 for ubuntu 14.04

  • Check the nginx logs to see what the startup errors are – Robbie Averill Jun 20 '16 at 7:14
  • run nginx -t to see whats wrong – MagenX Jun 20 '16 at 7:49
  • if you copy-paste configs then something is incomplete, some files or settings just missing.move all configuration, run nginx test – MagenX Jun 20 '16 at 8:12
  • I open sudo nano /var/run/php/php7.0-fpm.sock He was empty... – Sylon Jun 22 '16 at 2:20
  • Maybe someone will write a short sequence of settings and actions? Please. – Sylon Jun 22 '16 at 2:51
10

Magento2 contains Nginx config nginx.conf.sample that can be included in you server section. Let's try with minimal configuration;

You need to modify /etc/nginx/sites-available/my-domen.com with content

upstream fastcgi_backend {
    # socket
    # server unix:/var/run/php5-fpm.sock;
   server   unix:/var/run/php/php7.0-fpm.sock;
    # use tcp connection
    #  server  127.0.0.1:9000;

}
server {
    listen 80;
    server_name www.my-domen.com;
    return 301 $scheme://www.my-domen.com$request_uri;
}

server {
    listen 80 reuseport;
    server_name my-domen.com;

    set $MAGE_ROOT /var/www/my-domen.com/html;

   set $MAGE_MODE developer;
#    set $MAGE_MODE default;
#    set $MAGE_MODE production;

    include /var/www/my-domen.com/html/nginx.conf.sample;
    fastcgi_read_timeout 3000;
}

and then add other settings do not relate to Magento

  • What have you added or changed in this answer? Can you clarify? – Robbie Averill Jun 20 '16 at 7:17
  • I meant please add to your answer :-) – Robbie Averill Jun 20 '16 at 7:20
  • 1
    the problem not in nginx config but in "copy-paste" issue, i think something is missing there, and you have to teach them to fix the issue, instead you offer him another copy-paste. this is the never ending story... – MagenX Jun 20 '16 at 8:09
  • Unfortunately it does not work. Please write steps after install: nginx, php7, mysql. Maybe I made a mistake. – Sylon Jun 20 '16 at 11:02
  • I showed in the issue at the top of the image and error logs. – Sylon Jun 21 '16 at 14:52
3

you need to run nginx -t to see whats missing.

anyway i think you forgot to move other config files, we have installer for this https://raw.githubusercontent.com/magenx/Magento-nginx-config/master/m2_config_install.sh

this will take all nginx configuration files from our repository and copy them to your nginx folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.