Finding nginx config for 2.0

I am not finding a 2.0 equivalent for http://www.yiiframework.com/doc/guide/1.1/en/quickstart.apache-nginx-config

A quick start with getting my first yii 2.0 app up on an nginx webserver would be just the ticket! That page is exactly what I hoped for, but apparently no longer applies.

The forum search is global? When I am inside the 2.0 forum I get results with older dates? Did I miss a trick?

Thank you

Have you seen this http://www.yiiframework.com/doc-2.0/guide-start-installation.html#recommended-nginx-configuration ?

Thank you very much.

For what it’s worth: the first time I stopped reading at

"Info: You may skip this subsection for now if you are just test driving Yii with no intention of deploying it to a production server."

And on the second read (with every intention of deploying on a production server), I stopped at the big Congratulations! screen print.

Sigh.

Now I am still a bit ignorant. I use a VM on my laptop, which someone smarter than me set up.

I find I can only run composer create-project --prefer-dist yiisoft/yii2-app-advanced myapp from a folder which is part of a website. Anywhere else and it hangs. Hey, that’s what the docs tell us!

No problem, but I don’t want the whole project web-accessible, and I have other sites on the same domain to consider.

I guess my question is this. Once I have generated an app, can I move it somewhere else? Preliminary grep says yes.

But if I do, then ONLY the app’s web folder will be web-accessible.

Will this then be a problem when it comes time to update via composer? Yes, I already answered my question be starting out with "it only runs from a web-accessible location".

Meantime I will keep everything under the webroot and try to keep myself safe with nginx location blocks…

Clearly you don’t want to whole framework+app on the web. Yet yii needs composer updates.

Am I right to think this is handled by nginx conf? The normally-above-the-webroot app scripts will have to be web-accessible…

Sorry to be verbose…

I haven’t got much experience with nginx so someone else should guide you through the process of setting the virtual host but few things are clear:

  • only ‘web’ folder should be web-accessible

  • you should be able to run composer from any folder.

This is my problem.

I do not know how to solve it. That may take some time.

Meantime, do I need to be stopped in my tracks?

For composer to work, I had to create the project in the web root

/home/me/mysite/public/myapp

Now, can I move myapp to above the root, and just change these three lines in web/index.php:




require(__DIR__ . '/../vendor/autoload.php');

require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/../config/web.php');



…so that instead of one level up, they include DIR . ‘…/…/’ … two levels up.

In other words, is there any way for me to proceed "manually". Is it possible to move these around or am I playing with fire?

The other thing I can try is generating the project on a live server and then copying it to this rogue VM.

Therein lies another problem/question for later. But in theory that would be a workaround. Yes?