4

I install my Magento CE 1.8.1 on Nginx server.

My nginx conf file is like this: Configuring nginx for Magento

I created a subfolder in Magento root folder, then put in it some php files. I tried to execute those files by visiting urls (http://example.com/magento/subfolder/myfile.php) but it displays Magento 404 page. That means it was forced to rewrite by conf.

I looked into Magento default .htaccess file and found these lines:

############################################
## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

How to convert this into nginx conf and make existing files executable?

  • This question appears to be off-topic because it is about nginx configuration – Fabian Blechschmidt May 22 '14 at 16:01
1

You're probably looking for the try_files directive. Take a look at https://stackoverflow.com/questions/12206560/converting-apache-rewrite-rules-to-an-nginx-config-file

  • Thanks for your comment but it doesn't solve the problem. 404 page still shows. Please look into this to help me figure out where is problem. – Tran Dinh Khanh Mar 4 '14 at 2:18
0

This is already in the configuration provided by the example by Magento. Your problem lies elsewhere and unless you provide the actual configuration you created or some logs, we can't help you fix it.

  • My nginx configuration file is exactly same as Magento suggestion, I just modified my domain name. Please take a time to look into it and help me fix. – Tran Dinh Khanh Mar 4 '14 at 2:19
  • That configuration works. So, we can discuss at length, or you can post your configuration and the path to your document root so we can see what typos you may have made. As Douglas said, the try_files bit in that configuration is exactly the same as Apache's lines you pasted above. – Melvyn Mar 4 '14 at 6:29
  • Thanks for your help. Finally, I found the configuration didn't cause, but my code itself. In php files, I called "Mage" class, so it worked like Magento. :D – Tran Dinh Khanh Mar 5 '14 at 2:49

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.