Iam trying to install Magento 2.0 CE on an AWS EC2 Instance with Amazon Linux (CentOS). It runs with Apache all right, but I want to get it up and running on nginx.
PHP 5.6 FPM and all PHP extensions are running, but the Setup Wizard is an blank page. Installing via Command Line works but afterwards I only get 403 pages. Could anyone share his nginx config? I would appreciate any help!
Solved! Go to Solution.
Hello,
You try my current nginx config:
########################## server { listen 80; root /var/www/magen2; #Use you mangeto2 location index index.php index.html index.htm; server_name magen2.loc; access_log /var/log/nginx/www.magen2-access_log; error_log /var/log/nginx/www.magen2-error_log; #location / { #try_files $uri $uri/ /index.php?q=$uri&$args; #} location /setup { try_files $uri $uri/ @setuphandler; } # Rewrite Setup’s Internal Requests location @setuphandler { rewrite /setup /setup/index.php; } location / { index index.php index.html; try_files $uri $uri/ @handler; } # Rewrite Internal Requests location @handler { rewrite / /index.php; } location /pub/static { try_files $uri $uri/ @static; } location @static { rewrite ^/pub/static/(.*)$ /pub/static.php?resource=$1? last; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } #pass the PHP scripts to f stcgi socket location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_read_timeout 900s; #Magento 2 Developer Mode fastcgi_param MAGE_MODE "developer"; } } #########################
Hello,
You try example nginx config under Magento root folder? <MAGE ROOT>nginx.conf.sample
Hi,
thanks for your assistance.
I already tried to activate the "nginx.conf.sample" with an include in the nginx.conf, but there is the following error "
nginx: [emerg] "location" directive is not allowed here in ###"
Do I have to make changes in the file?
Hello,
You try my current nginx config:
########################## server { listen 80; root /var/www/magen2; #Use you mangeto2 location index index.php index.html index.htm; server_name magen2.loc; access_log /var/log/nginx/www.magen2-access_log; error_log /var/log/nginx/www.magen2-error_log; #location / { #try_files $uri $uri/ /index.php?q=$uri&$args; #} location /setup { try_files $uri $uri/ @setuphandler; } # Rewrite Setup’s Internal Requests location @setuphandler { rewrite /setup /setup/index.php; } location / { index index.php index.html; try_files $uri $uri/ @handler; } # Rewrite Internal Requests location @handler { rewrite / /index.php; } location /pub/static { try_files $uri $uri/ @static; } location @static { rewrite ^/pub/static/(.*)$ /pub/static.php?resource=$1? last; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } #pass the PHP scripts to f stcgi socket location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_read_timeout 900s; #Magento 2 Developer Mode fastcgi_param MAGE_MODE "developer"; } } #########################
I am still facing the 403 forbidden error after placing the above config.