Reputation: 7752
I'm trying to install Magento 1.9 on a Amazon EC2 server which is running NGINX & HHVM. I've got HHVM & NGINX running and when I put the EC2 Serers's IP in the URL I get the NGINX welcome screen displayed but when I put in the url to my Magento app (i.e. http://54.???.??.???/dev-magento) I get a 404 error.
I've put Magento in /var/www/dev-magento rather than /usr/share/nginx/html/. I intend to have a staging-magento site also which is why I'm not just dropping Magento into /usr/share/nginx/html/.
I've set up the /etc/www/ directory with
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data ubuntu
I've also put created an nginx configuration file for the dev-magento site in /etc/nginx/sites-available.dev-magento
server {
# Listen on port 80 as well as post 443 for SSL connections.
listen 80;
#listen 443 default ssl;
server_name 54.???.??.???/dev-magento;
# Specify path to your SSL certificates.
#ssl_certificate /etc/nginx/certificates/yourcertificate.crt;
#ssl_certificate_key /etc/nginx/certificates/yourcertificate.key;
# Path to the files in which you wish to
# store your access and error logs.
#access_log /path/to/your/logs/access_log;
#error_log /path/to/your/logs/error_log;
# If the site is accessed via mydomain.com
# automatically redirect to www.magento.localhost.com.
#if ($host = 'dev-magento' ) {
#rewrite ^/(.*)$ http://www.dev-magento/$1permanent;
#}
root /var/www/dev-magento/;
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
}
# Deny access to specific directories no one
# in particular needs access to anyways.
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
# Allow only those who have a login name and password
# to view the export folder. Refer to /etc/nginx/htpassword.
#location /var/export/ {
# auth_basic "Restricted";
# auth_basic_user_file htpasswd;
# autoindex on;
#}
# Deny all attempts to access hidden files
# such as .htaccess, .htpasswd, etc...
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# This redirect is added so to use Magentos
# common front handler when handling incoming URLs.
location @handler {
rewrite / /index.php;
}
# Forward paths such as /js/index.php/x.js
# to their relevant handler.
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
# Handle the exectution of .php files.
location ~ .php$ {
if (!-e $request_filename) {
rewrite / /index.php last;
}
expires off;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;
}
}
After which I ran:
sudo ln -s /etc/nginx/sites-available/dev-magento /etc/nginx/sites-enabled/
sudo service nginx restart
sudo service hhvm restart
However I'm still getting a 404 page when I go to 54.???.??.???/dev-magento.
I think I must be missing something pretty obvhious as I'm very new to AWS & NGINX configurations.
Upvotes: 2
Views: 537
Reputation: 7752
I was able to fix this by I changing the server name in my nginx configuration file to server_name dev-magento;
and then adding 54.???.??.??? dev-magento
to my local machines /etc/hosts file.
Upvotes: 0