Chrome workspace not liverefreshing static files with virtualhosts - css

I am working with compiled static css files on chrome workspace.
I am using gulp-less workflow for the compilation process from less to css and live editing less files to get expected css output on chrome workspace via dev tools.
Everything worked fine and i keep getting css on dev tools when i was accessing website with localhost i.e. http://127.0.0.1/website/ but now i need to setup virtualhost to run multiple website on the same localhost server.
Added required entries in the /opt/lampp/etc/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName local.website.com
DocumentRoot /opt/lampp/htdocs/website/
</VirtualHost>
as well as etc/host entry at the system level to map the ip to domain.
127.0.0.1 local.website.com
After moving to virtual-host http://local.website.com/, i can't get refreshed files from workspace.
What are the required configurations for setting up workspace to have better frontend workflow with virtual host?
Any help will be great.

Issue was due to regenerating same directory after clearing it.
So after removing from workspace and re-adding newlly generated files in workspace with proper permission works fine.

Related

Configuring Web Server in Google Cloud Compute Engine

I have a dash application in a compute engine instance that I'm looking to view in my browser. HTTP and HTTPS traffic is enabled and the instance has a static IP address. The apache server works and when I first ran an application, the default index page located at /var/www/html showed up at the browser address http://EXTENAL_IP_OF_VM_INSTANCE
From what I've seen elsewhere, web application files tend to be stored in the /var/www directory and the index.html file is present as the default page. However I have a single app.py file that I want to run which is located in the /home/user directory, so not in any particular web directory.
I run the app by entering python3 app.py and it does run:
Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
However, going to the instance's external IP address (34.89.0.xx) in my browser doesn't show the app, instead it shows text from an old 'hello world' application I made previously, that I thought I had deleted but is still showing up.
Part of the server configuration file apache2.conf is below:
The sites-available folder contains two files, 000-default.conf and default-ssl.conf, both with /var/www/html as the DocumentRoot. 000-default.conf is also in the sites-available folder, and is the only file there.
I tried changing the DocumentRoot in these files to /home/user where the app.py file is which didn't work, then I tried moving the file to the web directory /var/www which didn't work either.
Does anyone have any suggestions on how to fix this so that I can see my application in the browser?

loading Module mod_rewrite on httpd.conf file causes "Forbidden" error on localhost

Im on a mac running Sierra 10.12.2 and apache 2.4.23
I set up a localhost environment and a virtualhost for the domain cumsa.mx and installed wordpress on it. Without getting too into detail now, some changes were made on Git that modified the wp permalinks, and hence the .htaccess file through wp.
I went to my main httpd.conf file and told it to load the module mod_rewrite as suggested by a colleague since that was necessary to be able to modify the htaccess file. Regardless of that, activating this module results in my local environment for cumsa.mx to become "Forbidden".
Can anyone think of any idea why this wouldbe the case or which permissions I need to modify and how? Thanks!

Wordpress Noob: Forbidden You don't have permission to access / on this server. (using Mac)

So I followed this tutorial to set up my wordpress project on my local: http://jason.pureconcepts.net/2012/10/install-apache-php-mysql-mac-os-x/
However, it is giving me a
Forbidden You don't have permission to access / on this server.
error. I even tried changing the permissions of my project to 777, but nothing works. I should have Apache, MySQL, and PHP all running now. This is my /etc/apache2/extra/httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.local
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my /etc/hosts has this line 127.0.0.1 ahrf.local added. So it looks like my apache config + hosts file are configured properly. I even tried adding the default _www apache user to the staff group on my mac.
Does anyone know how to fix this?
While Macs are immensely easy and dumbed down compared to Linux and Unix Apple has added a ton more overhead in terms of trying to configure one as a server like you would normally configure a Unix or Linux system. They're running their own custom systems like Rendezvous, so there's a little more to configure and troubleshoot. That being said, here are a few things:
You should be able to connect to the system with the IP address and see the website. If you're not running a DNS server then the system will not publish the ahrf.local name. You would need to edit the hosts file of any systems trying to connect using that name. So on computer 2 you would edit the hosts file to see ahrf.local as 192.168.x.x (with the proper ip address for the web server of course).
If you install BIND you will need to make all of the other local machines check the DNS server first to see if the system exists.
Change permissions recursively in the folder to 755. You should never allow 777 because this allows "everybody" write access on the box. Wordpress has a ton of holes which can be found online by searching "Wordpress Hacked."
On Macs there's an issue with using the .local domain. .local is reserved for Rendezvous. While it will share files with this naming convention it's not really a published "domain name" and it will conflict with rendezvous if you're trying to use it in DNS.
Make sure (if you have firewall enabled under security) in the firewall you're allowing connections over port 80.
There is a web sharing option under newer versions of Mac OS. In my experience a lot of the systems that are in place in the GUI actually overwrite some of the command line additions. You'll need to either use the GUI exclusively or use the command line exclusively and then try to hunt down any issues in the GUI preventing the system from loading the page.
You don't need to run Apache as any other names or in any other groups other than the default as it only requires read and execute access to show the contents. The folders and files should have the permissions set for the user you're using to create the files. You don't want to make Apache own the files or you'll run into problems updating the system. Any folders where a user might upload a file like an image will need other permissions, but the main folder does not. Wordpress configures these settings on install.
If you want to run your Mac as a "production server" Apple has a "server" you can get "server" app from the app store that's basically another GUI interface for all of the stuff that normally comes available to Unix and Linux as installation options. It's cheap. This will allow you to run your own DNS server (and it's a little easier interface than editing BIND).
Also try pulling the directory declaration out of the VirtualHost. In all of the documentation examples they are separate.
<Directory "/Users/emai/Documents/wordpress_projects/ahrf">
Options -FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/Users/emai/Documents/wordpress_projects/ahrf"
ServerName ahrf.home
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>
Also remember after making changes to the .conf files you need to restart Apache. With .htaccess you do not have to restart after each change.
I know this is kind of old. But I followed same tutorial with my Mac machine to enable development with apache2 and faced the same situation.
To solve it I have added following line into my virtual host's directory. After that when I accessed a directory, apache didn't gave me a forbidden error.
Options Indexes FollowSymLinks MultiViews
After adding above line my virtual host configuration look like this.
<Directory "/Users/uiroshan/development/php">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Also please see the relevant section in apache documentation.
http://httpd.apache.org/docs/current/mod/core.html#options
Indexes
If a URL which maps to a directory is requested, and there is no DirectoryIndex (e.g., index.html) in that directory, then mod_autoindex will return a formatted listing of the directory.
Also enable the "Fancy directory listings" configuration file from your httpd.conf file.
Include /private/etc/apache2/extra/httpd-autoindex.conf
Hope this helps.
Easiest Solution I found was to symlink.
By default DocumentRoot is in /Library/WebServer/Documents
cd /Library/WebServer/
sudo mv Documents Documents-old
sudo ln -s <sourcedir> ./Documents
Dont mess up with OSX Apache config and break your head. Not worth it!

Drupal Acquia Stack - Have moved files to different folder, how to update site?

Im using the Acquia stack instead of MAMP or WAMP but im using it to run a normal Drupal installation.
I imported a site fine. Ive then moved the sites's files to a different folder, and now I cant figure out how to change the site's settings.
In the stack interface, if I go to my site and click settings > Sites > Edit
Then I can see the Site Path that it points to the old folder, but I cant change these settings.
Do I need to create a new site and import it again?
Thanks
I was looking for this answer, and digged out into acquia install folder. Here is what I did to change Site Path at acquia desktop interface.
Don't forget to make a backup just in case.
There are 4 files to attend to:
Open and edit static.ini and dynamic.ini under your AcquiaDevDesktopControlPanel at Program Files/acquia-drupal install folder. Maybe different on Mac.
Edit siteDir at static.ini
Edit selImportedSiteCodebase and codebaseDir at dynamic.ini
Edit httpd.conf at apache folder to use your new document root. There are 3 or 4 locations to change there
Edit vhosts.conf to reflect your new locations
You have to run the notepad as administrator.
Its seems that changing only #4 + #5 don't hurt my sites, these can be done via acquia interface. But changing #2 + #3 makes you feel comfortable :)
Hope that helps
I had the same question. I'm running Acquia Dev Desktop and wanted to change the default folder of the installation from /drupal-7.10 to /docroot.
I'm running this on a Mac and after reading the posts above, I searched for the dynamic.ini and static.ini files which were not to be found on my harddrive. Checked the httpd.conf file and didn't see anything mentioned.
I ended up making a backup copy of vhosts.conf and changed vhosts.conf to:
<VirtualHost *>
ServerName loc.MYWEBSITE.com
DocumentRoot "/Users/dv/Sites/MYWEBSITE/**new_dir_name**
<Directory "/Users/dv/Sites/MYWEBSITE/**new_dir_name**">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory<
<VirtualHost>
Refreshed the browser and I was good to go.
I ran into this problem as well, the only way I was able to remedy was to dump the database delete the project, then re-import. Just an FYI, make sure that the settings.php in Drupal are set up correctly for the localhost setup, this was another snafoo for me.
.. I looked all around the Acquia files to try to find a place where it was storing this information first but could not find it
In .htaccess, is the RewriteBase line pointing to the right directory? Ex:
RewriteBase /new/directory/
You'll also need to edit the - C:\Windows\System32\drivers\etc\hosts - file to update any entries
On Mac OS X you will need to find and edit paths in the following files:
~/.acquia/DevDesktop/locations.ini
~/.acquia/DevDesktop/Drush/Aliases/aliases.drushrc.php
/Applications/DevDesktop/apache/conf/vhosts.conf
/Applications/DevDesktop/apache/conf/httpd.conf
and, most importantly, in the DevDesktop package itself:
In /Applications/DevDesktop - right-click Acquia Dev Desktop
Select "Show Package Contents"
Edit datamodel.xml and static.ini

How to place certain files in the root directory of the Grails server?

I am using a grails application as backend for a Flex frontend. To be able to easily develop and debug my applications I would need to place a crossdomain.xml file into the root of the server, i.e. it must be accessible via http://localhost:8080/crossdomain.xml. Similar use cases might be the deployment of a favicon.ico or a robots.txt, however this can be done in the production environment through a tomcat server with a default root web application.
In my case however I need to have the crossdomain.xml available after running grails run-app. I know that I can move the entire application to the root (http://ca.rroll.net/2009/03/27/configuring-the-grails-root-application-context/) however this is also not what I want, since the grails application should still reside below its default application context.
Does somebody know, how I can do this? Will I have to reconfigure the jetty servlet container of my grails installation somehow?
I think I found the answer. I haven't tried this yet, so YMMV.
In this article, Colin Harrington discusses making a crossdomain.xml file available at the root of the server by deploying an additional Jetty context.
His technique was first proposed in this blog entry, where the author also discusses using the Static Resources Plugin as another alternative
I figured out a way to solve this with Apache and mod_proxy. This allows both your Grails install and Grails project to remain pristine. No hacking at the Grails internals, no adding plug-ins you may not need in production.
1. Install Apache httpd 2.2
Do this however makes the most sense for your operating system. It is important that you install Apache 2.2. I did this on an Ubuntu system, so any specific commands and file locations will be for Ubuntu. Modify as necessary for your system.
After you've installed Apache, start httpd.
sudo /sbin/service httpd start
Test that it is installed correctly using a web browser.
2. Create a root directory
Pick a location on your disk where you will keep your static files. This will be the document root for httpd. I will be using /var/grails_root.
mkdir /var/grails_root
touch /var/grails_root/crossdomain.xml
3. Create a VirtualHost in httpd.conf
Open httpd.conf in your favorite text editor.
vim /etc/httpd/conf/httpd.conf
Pick your favorite port, and create a virtual host on that port. I will be using 9090, but any port will do.
Add these lines to httpd.conf
Listen 9090
<VirtualHost *:9090>
DocumentRoot "/var/grails_root"
<Directory "/var/grails_root">
Allow from all
</Directory>
</VirtualHost>
Restart httpd
sudo /sbin/service httpd restart
Test that you are now able to access the static files in your document root directory. If not, you will need to fix this before moving on to the next step.
4. Enable mod_proxy and mod_proxy_http
You need to load both of these modules. mod_proxy has the base functionality for proxying, and the mod_proxy_xxx modules have information specific to a protocol. They ship standard with httpd 2.2, so you shouldn't need to install anything extra.
Add these lines to httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Now modify the virtual host you set up in the previous step. (You can omit the comments)
<VirtualHost *:9090>
DocumentRoot "/var/grails_root"
<Directory "/var/grails_root">
Allow from all
</Directory>
# New lines start here
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /grailsApp http://your.grails.server:8080/grailsApp
# New lines end here
</VirtualHost>
Restart httpd
sudo /sbin/service httpd restart
Now, you should be able to access both your static files and your Grails app via port 9090.
This is all based on information found here: http://docs.codehaus.org/display/JETTY/Configuring+mod_proxy
Information for doing this with other versions of Apache is available on the same site.

Resources