Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not install 2.0.0.0-dev81 #586

Closed
guoguolong opened this issue Jun 8, 2014 · 26 comments
Closed

Can not install 2.0.0.0-dev81 #586

guoguolong opened this issue Jun 8, 2014 · 26 comments
Assignees

Comments

@guoguolong
Copy link

Magento2 will never be installed since 2.0.0.0-dev80. When I access magento2 url (mined is magento2.me), I got disordered page in a long long time, and no css & js apply to it. I viewed the http request by firebug, saw lots of 500 internal error. I used nginx as webserver. below is my nginx configuration(It's worked before dev80)

server {
listen 80;

server_name magento2.me;
root /projects/magento2.me;

error_log logs/magento2.error.log;
access_log logs/magento2.access.log;

location / {
index index.php;
try_files $uri $uri/ @handler;
expires off; ## Assume all files are cachable
}

location @handler { 
rewrite / /index.php;

}

location ~ ^/(.).php(/|$) {
#if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+.php)(/.
)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}

Can anyone give me some suggestions?

@kandy
Copy link
Contributor

kandy commented Jun 8, 2014

the static files materialization was changed.
see: https://github.com/magento/magento2/blob/master/pub/static/.htaccess for more details

@guoguolong
Copy link
Author

@kandy Thanks so much. But... how can I translated it into nginx configuration file?
I added below the lines:
location /pub/static/(.) {
if (!-f $request_filename) {
rewrite /pub/static/(.
) /pub/static.php?resource=$1 break;
}
}

It seems to work a little .. but not really work.

@clockworkgeek
Copy link

This looks like a basic regex mistake. /pub/static/(.) should be /pub/static/(.*) otherwise it will only capture the first character.

@verklov verklov self-assigned this Jun 13, 2014
@verklov
Copy link
Contributor

verklov commented Jun 13, 2014

@guoguolong, sorry for the delay. Did you have your issue resolved? If not, we will try to provide you with some solution.

@ryan-brady
Copy link

@guoguolong
location /pub/static {
rewrite ^/pub/static/(.*)$ /pub/static.php?resource=$1? last;
}

@tim-bezhashvyly
Copy link

Confirming. The ruleset above works for static files materialisation w/ nginx.

@csdougliss
Copy link
Contributor

Would you have a full nginx vhost config for magento2 that I could see? Thanks

@tim-bezhashvyly
Copy link

I posted mine here.

@guoguolong
Copy link
Author

@ryan-brady @verklov
sorry to response late. It finally works . below is full nginx configuraiton of mine:

server {
  listen 80;

  server_name magento2.me; # my domain for test
  root /projects/magento2.me; 

  error_log logs/magento2.error.log;
  access_log logs/magento2.access.log;

  location / {
    index index.php;
    try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
     expires off; ## Assume all files are cachable
  }
  location @handler { ## Magento uses a common front handler
    rewrite / /index.php;
  }
  location /pub/static {
    rewrite ^/pub/static/(.*)$ /pub/static.php?resource=$1? last;
  } 

  # Foward php request to FastCGI server.
  location ~ ^/(.*)\.php(/|$) {
    #if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  HTTPS              off;
  }
}

@csdougliss
Copy link
Contributor

When I use:

http://www.site.co.uk/static/install/Magento/basic/en_US/Magento_Theme/favicon.ico I get a 404 from the static rewrite?

However,

http://www.site.co.uk/static/install/Magento/basic/en_US/Magento_Theme/favicon does work with the rewrite *tested using a echo/die in static.php

@tim-bezhashvyly
Copy link

@craigcarnell Apache or Nginx?

@csdougliss
Copy link
Contributor

@tim-bezhashvyly It's nginx

@tim-bezhashvyly
Copy link

Have you added rewrite rules for the /static/ dir to your server block?

@csdougliss
Copy link
Contributor

This is my hosts config in nginx if it helps:

    server {
  listen                *:80;

  server_name           site.co.uk www.site.co.uk;
  root /var/www/vhosts/magento2-capistrano/current/pub;
    index  index.html index.htm index.php;


  access_log            /var/log/nginx/www.site.co.uk.access.log combined buffer=16k;

  error_log             /var/log/nginx/www.site.co.uk.error.log;

    location / {
        index index.html index.php;    # Display Static File
        try_files $uri $uri/ @handler; # Pass URI to Front Handler
        expires 30d;                   # Cache Assets
    }

    # Turn off Logs for Media
    location ~* "^.+\.(jpg|jpeg|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf|mp4|webm)$" {
        expires    max;
        add_header Cache-Control public;
        access_log off;
    }

    # Rewrite magento2 static files
        location /static {
        rewrite ^/static/(.*)$ /static.php?resource=$1 last;
        }

    # Hidden Files
    location  /. {
        return 404;
    }

    # Rewrite Internal Requests
    location @handler {
        rewrite / /index.php;
    }

    # Rewrite PHP Requests
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    # Deny cron on web
        location ~ /cron\.php$ {
        deny all;
    }

    # Magento Location
    location ~ \.php$ {
        # Catch 404s
        if (!-e $request_filename) {
            rewrite / /index.php last;
        }

        # Do not cache dynamic content
        expires        off;

        fastcgi_read_timeout 900s;
        fastcgi_index index.php;
        fastcgi_pass   unix:/var/run/hhvm/hhvm.sock;
        fastcgi_param  SCRIPT_FILENAME           $document_root$fastcgi_script_name;

        fastcgi_param  MAGE_RUN_CODE             codesocial_uk;
        fastcgi_param  MAGE_RUN_TYPE             store;
        include        /etc/nginx/fastcgi_params;
    }}

@csdougliss
Copy link
Contributor

There are no files in static, I am not sure if it's because the rewrite rule is not working so the files never get generated, or it's an issue installing (first time run)

@clockworkgeek
Copy link

@craigcarnell Check write permissions in that directory for PHP's user.

@csdougliss
Copy link
Contributor

The server is running as www-data, the static directory is owned by www-data with 777 permissions and still no files

@csdougliss
Copy link
Contributor

As I have an echo and die in my static.php surely that means the rewrite is not working anyway regardless of no files in static?

@kandy
Copy link
Contributor

kandy commented Jun 30, 2014

try comment

location ~* "^.+\.(jpg|jpeg|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf|mp4|webm)$" {
        expires    max;
        add_header Cache-Control public;
        access_log off;
    }

@csdougliss
Copy link
Contributor

I have fixed the rewrite:

 # Rewrite magento2 static files
        location /static {
        rewrite ^(.*)$ /static.php?resource=$1? last;
        }

However, no files are being generated in static

@csdougliss
Copy link
Contributor

Am I right that my nginx document root should be the pub folder? i.e. index.php, static.php in that folder?

@csdougliss
Copy link
Contributor

Hi @kandy I tried your suggestion but with no luck

@buskamuza
Copy link
Contributor

@craigcarnell , your nginx root should be either root of Magento directory or pub sub-directory. Could you, please, check if everything works, if you setup root nginx directory to root directory of Magento application?

If you work in developer mode, no view files should appear in pub/static directory, so it's OK. The problem is, if HTTP requests to the files return error.

@verklov
Copy link
Contributor

verklov commented Jul 16, 2014

@guoguolong, the team created a set of instructions on how to properly configure nginx to install Magento. I moved this information to the wiki page in this repository and it is available by the link: https://github.com/magento/magento2/wiki/Nginx-Configuration-Settings-and-Environment-Variables. I hope this helps you and other Community members trying to use nginx instead of apache.

@leeyisoft
Copy link

GET http://127.0.0.2/static/install/Magento/basic/en_US/jquery/jquery.js 404 (Not Found)

\magento2\pub\static is emtpy

PHP Version 5.4.30

System Windows NT PC201406301552 6.1 build 7601 (Windows 7 Ultimate Edition Service Pack 1) i586
Build Date Jun 25 2014 18:03:31
Compiler MSVC9 (Visual C++ 2008)

server {
listen *:80;

server_name           127.0.0.2;
root D:/workspace/magento2/pub;
index  index.html index.htm index.php;
#access_log            /var/log/nginx/www.site.co.uk.access.log combined buffer=16k;

error_log             D:/workspace/magento2-error.log;

location / {
    index index.html index.php;    # Display Static File
    try_files $uri $uri/ @handler; # Pass URI to Front Handler
    expires 30d;                   # Cache Assets
}


# Rewrite Internal Requests
location @handler {
    rewrite / /index.php;
}

# Turn off Logs for Media
location ~* "^.+\.(jpg|jpeg|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf|mp4|webm)$" {
    expires    max;
    add_header Cache-Control public;
    access_log off;
}
 # Rewrite magento2 static files
    location /static {
rewrite ^(.*)$ /static.php?resource=$1? last;
}
# Hidden Files
location  /. {
    return 404;
}
# Rewrite PHP Requests
location ~ .php/ {
    rewrite ^(.*.php)/ $1 last;
}

# Deny cron on web
    location ~ /cron\.php$ {
    deny all;
}

location ~ \.php$ {
    # Catch 404s
    if (!-e $request_filename) {
        rewrite / /index.php last;
    }
    # Do not cache dynamic content
    expires        off;

    fastcgi_read_timeout 900s;

    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  MAGE_RUN_CODE             codesocial_uk;
    fastcgi_param  MAGE_RUN_TYPE             store;
    include        fastcgi_params;
}

}

magento-team pushed a commit that referenced this issue Apr 30, 2016
…ub-fix-integration-test

[Extensibility] Magetwo 52414 GitHub fix integration test
magento-engcom-team added a commit that referenced this issue Apr 12, 2019
…overage #586

 - Merge Pull Request magento/graphql-ce#586 from magento/graphql-ce:graphQl-581-set-shipping-method-on-an-empty-cart-test-coverage
 - Merged commits:
   1. 8e40ce2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants