Which folder to keep projects for Homebrew nginx port 8080 - macos

I am using macbook and installed nginx using Homebrew from the terminal. I think i installed 2-3 versions of nginx in different locations. Now I can see my http://localhost:8080/ is working as it displays nginx home page in browser but how can I place my projects inside nginx? I tried to put those in one of the nginx directory but it does not work if if I try to go to project through browser.
Is there anything from where I can find the exact directory of this running version of nginx?

Use the brew list command:
$ brew list nginx
/usr/local/Cellar/nginx/1.10.1/bin/nginx
/usr/local/Cellar/nginx/1.10.1/homebrew.mxcl.nginx.plist
/usr/local/Cellar/nginx/1.10.1/html -> ../../../var/www
/usr/local/Cellar/nginx/1.10.1/share/man/man8/nginx.8
$ greadlink -f /usr/local/Cellar/nginx/1.10.1/html
/usr/local/var/www
Thus, the symlink links to /usr/local/var/www, and default configuration is likely to do likewise.

Related

Setting Up Symfony Dev Environment in Heroku

So as the title suggests, I am setting up a Symfony project in heroku. It is on my Mac OSX laptop. I followed the directions here to set it up. I got everything installed, pushed my project to heroku, tested it and it works on the web.
Now I'm trying to set up the local dev environment. I would like to be able to simply use heroku local to launch the dev server as usual. I installed the heroku php buildpack, and I created a Procfile with these contents:
web: $(composer config bin-dir)/heroku-php-apache2 web/
the composer config bin-dir command returns vendor/bin, and then I can see that heroku-php-apache2 file in there. Everything looks good.
When I run heroku local I get this error:
[WARN] No ENV file found
15:48:49 web.1 | This program requires Apache 2.4.10 or newer with mod_proxy and mod_proxy_fcgi enabled; check your 'httpd' command.
15:48:49 web.1 Exited with exit code 1
So I checked the httpd -v and I have:
Server version: Apache/2.4.27 (Unix)
Server built: Oct 3 2017 10:26:24
I just enabled (uncommented) mod_proxy and mod_proxy_fcgi in the /etc/apache2/httpd.conf file and restarted the machine, but still seeing the same error. I am starting to think it is a problem with my Procfile or something.
Any help is greatly appreciated.
For anyone having a similar problem, I was able to fix the issue. The issue WAS that I edited the wrong httpd.conf file, since I installed the apache from homebrew.
The path /etc/apache2/httpd.conf is correct if you are using the default apache2 installation on the mac. If you installed apache from homebrew like I did, you will find the httpd.conf file at /usr/local/etc/httpd/httpd.conf.
You need to uncomment the 2 lines for mod_proxy and mod_proxy_fcgi and also uncomment the port listener directive, since heroku likes to listen on non-default port 5000 and heroku will automatically do that at run time.
Also the server cannot be running already when you use heroku local.
:-)

Can't change document root for apache 2.4

I want to set up local web server using Apache and PHP on my Mac running Sierra. I followed this tutorial:
https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
And I am stuck at changing the document root from httpd.config, for whatever reason this change does not take effect at all. If I type http://localhost it still says "It works", it still uses the original html file.
Another weird thing is that apparently I can't stop apache at all. I tried running
$ sudo apachectl stop
but I still can’t access http://localhost
if I run
$ brew services list
httpd24 is stopped. What gives? What am I doing wrong?
There is an instance of apache pre-installed with macOS. So you have now two versions of apache installed. If you check:
which apachectl
you will probably obtain:
/usr/sbin/apachectl
which is the official macOS version of apachectl. Stop it with:
sudo apachectl stop
Disable the auto-loading of the pre-installed apache with (as explained in the tutorial you mentioned):
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
To run the homebrew version do:
brew services run httpd24
to stop it:
brew services stop httpd24
to register it to launch at login:
brew services start httpd24

NGINX cmd command does not work

When i use my mac, i installed by brew. And it made all command usable every where
But, chocolatey does not allow windows to install NGINX.
So i downloaded under the C: and unzipped it.
Unlike Mac, i can't use NGINX or NGINX -s reload.
I think the 'bin' folder should be located in window 'PATH', but i could not know where it is.
When i order 'NGINX', cmd returns NGINX is not internal or external command.
How can i use these commands? Even though, Windows' directory tree is not similar with Mac's
If you download the nginx binary package from nginx website,when you unpacked it,there was no bin folder in it.The executable application is nginx.exe.The following is what looks like if you use ls command in the nginx directory.
C:\nginx-1.8.1>ls -1
conf
contrib
docs
html
logs
nginx.exe
temp

Does reinstalling Macports remove/destroy contents of /opt/local/ directory structure?

I'm running a MacPro G5 w/ 10.5.8. I ran:
sudo port selfupdate and then ran:
sudo port upgrade outdated
When it was all finished, I rebooted and apache2 was broken and would not serve PHP file any longer. If I replace the httpd.conf file, it will serve html files.
I finally gave up and restored the backup and the machine is running again. The problem is I have a second machine that I did the same thing on and don't want to go through the same process. I've read several posts about uninstalling/reinstalling Macports like this one from Kirk Roybal How to do a clean reinstall with macports?, but it doesn't say if this process will destroy or reset the contents of the /opt/local/ directory. Especially the MySQL DBs and htdocs contents. Does anyone know if this process is linked or destructive? I'll make backups of everything, of course, before trying anything.
SOLUTION:
I got it to work by making the php53 install work instead of going backwards. Here's what I did:
sudo port select --set php php53 (set MacPorts to use php53 instead of php5)
sudo port installed (Check to make sure php53-apache2handler is installed)
sudo port install php53-apache2handler (It wasn't and yours probably isn't either)
once that's done installing
php -v (check the version of PHP that's running)
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n php mod_php53.so (activates php within apache)
this should append
LoadModule php5_module modules/mod_php53.so
to your /opt/local/apache2/conf/httpd.conf file (check it now)
There will also be a line like this
LoadModule php5_module modules/mod_php5.so
Comment it out or remove it so is doesn't interfere with new install
It should also move a copy of mod_php53.so to
/opt/local/apache2/modules
If it's not there, see php53-apache2handler install above.
Check your httpd.conf file for errors
/opt/local/apache2/bin/httpd -S
Finally, create/edit php.ini file to tell apache2 how to connect to MySQL database
cd /opt/local/etc/php53
sudo cp php.ini-production php.ini (for production machine use development for dev machine)
sudo cp php.ini php.ini.bak
Add the default socket paths to php.ini
pdo_mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock (may vary based on MySQL version. Check the /opt/local/var/run directory if not sure)
mysql.default_socket=/opt/local/var/run/mysql5/mysqld.sock
mysqli.default_socket=/opt/local/var/run/mysql5/mysqld.sock
If you are having problems connecting to MySQL, check for typos in the above paths FIRST. Trust me it will save you tons of time!
If all went according to plan, you should be able to restart the machine, test to make sure all ports started automatically and things should be working.
The files that you add (eg: MySQL DBs) are not destroyed by an update. If you modify files that are managed by MacPorts (eg: they are listed in 'port contents '), then those modifications will be clobbered by an update.
Some projects install config files as examples and have the user make the real config file so as to not clobber it with an update. It looks like the apache2 port follows this pattern. It installs /opt/local/apache2/conf/original/httpd.conf and then copies it to the real location of /opt/local/apache2/conf/httpd.conf at activation time only if the file does not exist.

Jekyll regeneration doesn't work inside Vagrant

Running the otherwise working command:
jekyll serve --watch
inside Vagrant is not leading to regeneration of the files unless I restart the jekyll server. I am editing on Windows. Is this a problem with Jekyll running inside Vagrant or is there some configuration that I need to do to make this work? I even tried using foreman with the following Procfile configuration but with the same result
web: jekyll serve --watch
It's implemented in the latest pre release (jekyll 2.0.0.alpha.3 by the time of writing).
You should use --force_polling option to get benefit of it.
Try running the jekyll server like this:
jekyll serve --watch --force_polling
My guess, based on nothing more than my own experience of this issue is that you are running your jekyll site in the /vagrant folder which vagrant maps/syncs back to the host os.
These mapped or synchronised folders are using some kind of crazy filesystem driver (basically a type of network share) and the file watch features don't work on them.
This SO question shows the same symptom.
(You will see what I mean of you run your jekyll site outside `/vagrant' like in the home folder. Make a change (using nano) and you will see the Regeneration triggering)
What provider are you using? I was able to get it to work on Windows 8 using Virtual Box as a provider and Ubuntu 12.04 as a guest OS. I had to use version 1.2.1 and not the latest version however.
When I use the latest Jekyll version (1.4.2), watch does not work as expected (it doesn't notice the file change and does not rebuild). It does work when I edit them on the guest OS though (it does notice the file change and will rebuild).
Version 1.2.1 works regardless of where the files are edited from (Guest OS or Host OS).
To revert back to version 1.2.1 I ran the following commands:
gem uninstall jekyll
gem install jekyll -v 1.2.1
Note: The jekyll site is running from the vagrant directory
In vagrant, just add --force_polling, then jekyll will watch almost all files except "_config.yml"
jekyll serve --force_polling
When you change the other files except for "_config.yml", you will see the regeneration.
But if you are changing "_config.yml" it will not trigger the regeneration.
Are you excepting the regeneration when you are changing "_config.yml"?
My guess (without knowing the details) is that you need to be running headless, as in:
jekyll serve -w --detach
as mentioned in the jekyll documentation. If it's not that, then describe the issue in more detail, as I asked about in the comment. Also, are you using any type of provisioner in Vagrant, e.g. shell, chef, ansible, etc.?

Resources