Zend Framework works with Nginx (without apache)?

1

I have a project developed in zf2 and currently I use a shared hosting with Apache, but I will migrate to the Digital Ocean VPS and I will configure the server with Nginx as it performs better.

That is, instead of Apache, I will use Nginx.

Will my system developed in ZF2 work normally in Nginx or do I have to do some modification?

    
asked by anonymous 26.10.2015 / 20:35

2 answers

3

I think the only Zf2 dependencies are in relation to PHP and mod_rewrite (if you use friendly urls ) as quoted in Zf's own handbook! .

If you use friendly urls (which is not a must) then you will have to make modifications, since the .htaccess file will not work in Ngnix because it is an Apache document , however Ngnix just like Apache allows you to create friendly urls

You can probably use try_files :

location / {
    try_files $uri $uri/ /index.php;
}

Ngnix documentation:

link

You'll probably be able to do everything with Ngnix in Apache , however in another way.

A page that can help you convert your .htacces file: link

It's not as smart as a "person," but it helps to break a branch, however I recommend taking a look at Ngnix , it can be as simple as Apache.

Requirements:

The question here is just about dependencies on Zf2 in relation to Ngnix and there was no need to post about php itself, but I will cite PHP dependencies as an add-on that can help other people with doubts:

  • PHP 5.2.4 or higher

PHP extensions used by Zend components:

Not all extensions are required, this will depend on the

  • apc , Soft , bcmath , bitset , bz2 , calendar , com_dotnet , ctype , ZendGData , ZendHttpClient , ZendPdf , ZendRestClient , ZendRestServer , ZendSearchLucene , Zend_Uri Zend_Validate , curl , date , dba , dbase , dom , Zend_Dom , Zend_Feed ZendGData , ZendLogFormatterXml , ZendRestServer , Zend_Soap , ZendSearchLucene , ZendServiceAmazon , ZendServiceDelicious , ZendServiceFlickr , Zend_XmlRpc , exif , fbsql , fdf , filter , ftp , gd ZendPdf , gettext , gmp , hash , ibm_db2 , iconv , ZendLocaleFormat , Zend_Mime ZendPdf , ZendSearchLucene , ZendServiceAudioscrobbler , ZendServiceFlickr , ZendValidateHostname , ZendValidateStringLength , ZendXmlRpcClient , igbinary , imap , informix , interbase , json , ZendSerializerAdapterJson , ldap , libxml mbstring , mcrypt , memcache , mhash , mime_magic , ming , msql , mssql mysql , mysqli , ncurses , oci8 , odbc , openssl , pcntl , pcre , pdo , pdo_dblib , pdo_firebird , pdo_mssql , pdo_mysql , pdo_oci , pdo_pgsql pdo_sqlite , pgsql , posix , pspell , readline , recode , Reflection , Zend_Filter ZendFilterInput , Zend_Json , Zend_Log , ZendRestServer , ZendServerReflection , Zend_Validate , Zend_View , ZendXmlRpcServer , session Zend_Session , shmop , SimpleXML , Zend_Feed , ZendRestClient , ZendSerializerAdapterWddx , ZendServiceAudioscrobbler , Zend_Soap , Zend_XmlRpc , Soft , soap , Zend_Soap , sockets , SPL , SQLite
27.10.2015 / 04:10
3

I do not see why it might be a problem. HTTP servers do nothing more than respond to an access through a given URL, through a certain port, with the desired HTTP content.

What you need to check is if all the modules you need for the project are enabled, and the virtual host is correctly configured. Typically modules include support for the desired language (in this case, PHP), URL writing, SSH, among others. Virtual host configuration is also usually quiet.

    
26.10.2015 / 22:14