Does Zend Framework work with Nginx (without apache)?

Asked

Viewed 293 times

1

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

I mean, instead of Apache, I’ll use Nginx.

Will my system developed in ZF2 will work normally on Nginx or will have to make some modification?

  • Good evening, I wonder if any of the answers helped you, if not please comment on what you think is missing.

  • Hello, thanks for the reply of all, so I understood will work normal as long as all the necessary modules are enabled, just did not explain where is the configuration file to enable the modules

  • But you did not ask this, your question only speaks of ngnix and apache did not see you ask of modulos zf2.

  • My initial question was about working with Nginx, but the answers evolved to activate the necessary modules, I would just like to know where I activate these modules, if it is equal a file . htacess where you pass some settings, hugging

  • I understand, but it is so you must edit the question, friend please understand we are not a forum but a site of Q&A, I recommend that you read the maximum of http://answall.com/help, I hope you understand this as a constructive criticism :) - ps: I will try to edit the answer as soon as possible to give details about the zf2 modules (components)

  • Okay, thank you very much, this is my first question and I’m learning how it works, by the way the community is to congratulations, very helpful!

Show 1 more comment

2 answers

3

I don’t see why that would be a problem. HTTP servers do nothing more than respond to an access through a certain URL, through a certain port, with the desired HTTP content.

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

3


I believe that the only dependencies of Zf2 are in relation to PHP and mod_rewrite (if you’re going to use friendly urls) as quoted in own manual of the Zf!.

If you’re gonna use the friendly urls (which is not a must) then you will have to make modifications, since the file . htaccess will not work on Ngnix as it is an Apache document, however Ngnix as well as Apache allows you to create friendly urls

You can probably use the try_files:

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

Ngnix documentation:

https://www.nginx.com/resources/wiki/start/topics/recipes/zend/#time-for-Nginx

You’ll probably be able to do anything with Ngnix that would do in the Apache, however in another way.

A page that can help you convert your file. htacces: http://winginx.com/en/htaccess

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

Requirements:

The question here only talks 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 doubting people:

  • PHP 5.2.4 or later

PHP extensions used by the components of Zend:

Not all extensions will be needed, this will depend on the component

  • 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, standard, sybase, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, ZendTranslatorAdapterTmx, ZendTranslatorAdapterXliff, XMLReader, xmlrpc, XMLWriter, xsl, zip, zlib, ZendFilterCompress
  • I did not understand the negative in my reply, as far as I know the dependencies of Zf2 are in php and not in Apache, except for mod_rewrite (which may or may not be used), if there is something wrong with the reply please comment, so I can improve or delete. Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.