Why laravel homestead is not running Apache - apache

Obviously, I've Laravel project that really needs the .htaccess rules and Nginx doesn't seem to be the best solution for me,
1- my question is why Laravel didn't provide homestead with Apache!
After a small research that I made I found online tool for converting the rules but the output didn't work (was too short), whereas, Apache is more likely known and usable, plus it's easier to define rules for security and pretty URLs ..etc. ( at least for me )
2- Please give me answers explaining why they choose Nginx!, more importantly I need to know what Seniors and Experts will use ( Nginx, Apache )
3- Do you advise me to install Apache on Homestead?

Laravel homestead is currently able to install apache using your Homestead.yaml file.
Add a key to your sites called type. Set it to apache. like so:
sites:
- map: laravel.local
to: "/home/vagrant/laravel"
type: apache
Make sure you don't mix up apache and nginx, that won't work.
Then run vagrant up and to install apache and provision the right config files.
If it doesn't work, then first make sure to update to the latest version of homestead.
Here is an interesting article on the matter: https://www.nginx.com/blog/nginx-vs-apache-our-view/. TLDR: Nginx is faster.
Only when you have an existing project and you really need to use apache. Or in case your application is going to run on an apache server. Starting fresh? Use nginx.

Steps are as follows here.
SSH into vagrant -> vagrant ssh
Stop Nginx -> sudo service nginx stop
Remove it -> sudo apt-get purge nginx
Update you repos -> sudo apt-get update
Install apache -> sudo apt-get install apache2
Restart it -> sudo service apache2 restart
You are now on Apache server, update the apache conf file as your needs.

What exactly are you trying to do and perhaps we can supply a solution to your problem. You shouldn't really need to be rewriting URLs with .htaccess as Laravel's routing handles this.
1) Regardless of software, if you're needing to configure the webserver for each specific project, its probably better to go and configure your own vagrant box that is relevant for that project.
2) Nginx outperforms apache and reduces a lot of the bloat that simply isn't needed. Its also what forge uses and so homestead uses in turn so its mocking the forge environment.
3) See point 1, configure your own vagrant box for this project.

Related

How do you remove SSL encryption after letsencrypt set up forced SSL?

I chose to force https on my server when setting up let's encrypt, not realizing what a NIGHTMARE it would cause for my Node.js WebSocket server. Nothing that I've found online works to get a secure WebSocket connection up and running. (Probably because I'm using Apache for everything aside from WebSockets)
So I've decided to just disable SSL site-wide. I don't have any real use for it as my server is strictly for development anyway.
I've tried the method here But Apache reports that the site is already disabled. So I cleared the cache on my browser and even tried to visit the site incognito to no avail.
I also looked at the instructions here but NONE of my site-available contain the lines that are mentioned.
Then I saw this post but my apache2.conf file did not contain the lines he mentioned either.
I'm puling my hair out.
If anyone else has this issue, here's what I did to solve it.
I saw a configuration file named <sitenam>-le-ssl.conf in /etc/apache2/sites-enabled So I tried a2dissite <sitename>-le-ssl.conf
But Apache said "the file doesn't exist"
So I copied that file to my home directory with cp <sitename>-le-ssl.conf ~(AND YOU SHOULD TOO! just in case...)
Then I deleted that file with sudo rm <sitename>-le-ssl.conf
Then, restart apache with sudo service apache2 restart
Finally, clear the cache on your browser and visit your site. Everything should be back to normal now.
No idea why letsencrypt set up my server in such an odd way. It didn't follow ANY of the standards that others said it should.
Hope this helps someone in the future.

Need to set proxy server for apache tomcat in RHEL 7.3

I have 3 machines with ips 10...56,10...57 and 10...58. How do I connect all of them using a proxy via tomcat8.
Till now I have made a new file setenv.sh in tomcat8/bin/ folder and wrote the below lines. But it doesn't seem to work.
export JAVA_OPTS="$JAVA_OPTS Dhttp.proxyHost=10...56|10...57|10...58 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=10...56|10...57|10...58 -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost"
Let me know if I am following the right process or I need to modify any other file too.
Below link helps you in setting up the proxy with multiple
http://w3devops.com/add-http-https-proxy-http-non-proxy-jenkins-via-tomcat-server/
However, I think tomcat is not the best option to do the HTTP\HTTPS Proxy.
please feel free to experiment with apache or ngnix.
Apache
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
NGNIX
https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching
It may help you one day :)

How to run flask on apache using mod_wsgi-express on same ip as a subdomain

I want to run flask on apache.I have already installed mod_wsgi-express and my flask application is running on port 8000(localhost:8000) but i want to run my application as a subdomain i dont want to open a new port and want to run the application on same ip using '/'(ex- localhost/application).I have already drupal running on port 80.
So basically i want my drupal run on url(localhost) and flask app on url(localhost/flaskapp) .How can i do this?
Use your main Apache to run mod_wsgi as well, instead of mod_wsgi-express. Use mod_wsgi-express just for development.
Presuming you do not have mod_wsgi installed from a system package, you can run:
sudo mod_wsgi-express install-module
and it will copy the mod_wsgi module into your Apache configuration. The command will also output two lines that you need to include in your main Apache configuration to have it load mod_wsgi and set the correct location for your Python installation or virtual environment.
You should then configure your main Apache installation manually to have it also host your Flask application using mod_wsgi. See the Flask documentation on mod_wsgi for details, but because you still want to run a PHP application, also read:
http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html
Because where you put configuration for Apache depends on the Linux distribution used, can't tell you exactly where you need to put stuff and what steps you may need to do to enable it.

Drush with several Virtual Hosts on Apache web server

I have several Drupal installs on an Apache2 Web server.
Each install is a separate virtual host on the Document Root, like
/var/www/html/site-1
/var/www/html/site-2
/var/www/html/site-3
...
I want to perform Drush commands just on "site-1", for example install a module.
In order to do that just for "site-1", should i do the following?
1.) cd /var/www/html/site-1/sites/all/modules
2.) drush en module_name -y
Will the above download and enable "module_name" only for "site-1"?
Thanks!
You might want to use the option --rootto specify the webroot of your drupal installation. You can also specify the website URL using the option --uri, if you have a multisite installation. Look at http://docs.drush.org/en/master/usage/#options for an in-depth description.
But the best way to handle you setup is drush aliases (http://docs.drush.org/en/master/usage/#site-aliases). You define an alias #site1 etc. and this alias references the webroot and site URL (and optionally other parameters as well).
Yes, it will enable only site-1. If you just remain in /var/www/html/site-1/, that is enough.

serve cache/html pages created by wp-super-cache using lighttpd

Currently I have lighttpd configured as a reverse proxy of apache. Lighttpd listens on the public IP while apache listens on 127.0.0.1. Lighttpd passes non-static contents to apache using the configuration
$HTTP["url"] !~ "\.(js|css|gif|jpg|png|ico|txt|swf|html|htm|gz)$" {
proxy.server = ( "" => (
( "host" => "127.0.0.1", "port" => 80 )))
expire.url = ( "/" => "access 5 minutes")
}
This simple setup works just fine with a vanilla wordpress install. Static files are being served by lighttpd while everything else is served by apache.
I want to take it to the next level so I installed wp-super-cache so that cache/html version of pages are created. The wp-super-cache plugin has been installed properly and its modification to the htacess file has been properly applied. I used the mod_rewrite mode of wp-super-cache and the custom permalink structure of wordpress is /%category%/%postname%.html. All works great. Cache/html pages are being created and served. There is just one little problem. It will only work if I remove the html file extesion in the above configuration. This means apache will serve the cache/html files and not lighttpd. One solution that I thought of is to have simliar rewrite rules on lighttpd when accessing html files. I do not know if it will gonna work but I searched for it anyway. I found http://tempe.st/2008/05/lightning-speed-wordpress-with-lighttpd-and-supercache-part-ii/ (you may need google cache to access it because it was not working today, but yesterday it did) thinking it may be the solution but the bad news is I am using a rpm based distro and the rpm repo that I use does not have mod_magnet for lighttpd. I searched for other repos that offer lighttpd with mod_magnet but found none. So I cannot use the one solution that I have found because my lighttpd does not have mod_magnet functionality.
What should I do to make lighttpd serve the cache/html files that were created by wp-super-cache? Is this possible?
Thanks!
I know, it's a little bit late, but you could try my version of rewrite.lua script for WP Super Cache. It works just like it must work. https://gist.github.com/1258096