Unable to connect to local host after modifying Apache config file (Windows) - windows

I have downloaded the Apache HTTP server for windows and installed it. I have created a test html file under C:/mobileTraining/core/workspace/TestProject
I then added a permissions directory tag in the httpd.conf file, so that it now looks like the following:
<Directory />
AllowOverride none
Require all denied
</Directory>
<Directory C:/mobileTraining/core/workspace>
Order allow,deny
Allow from all
</Directory>
Alias /TestProject C:/mobileTraining/core/workspace/TestProject
I've tried this with and without the first Directory tag, which was there already.
When I then save these changes and go to http://localhost/TestProject/TestPage.html in my browser (I've tried Firefox and Chrome), I get a connection error. This is from Chrome:
This webpage is not available
Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.
Error code: ERR_CONNECTION_REFUSED
Is there something blindingly obvious in my set-up that I've missed?
Thanks

Try to access your site by including the port the default setup for this is 8080
http://localhost:8080/TestProject/TestPage.html

First, make sure you are able to access http://localhost/
Also, i suppose you have TestPage.html in C:/mobileTraining/core/workspace/TestProject
You are setting permissions for C:/mobileTraining/core/workspace ?
As mentioned in Example here . Try below.
Alias /TestProject "C:/mobileTraining/core/workspace/TestProject"
<Directory "C:/mobileTraining/core/workspace/TestProject">
Order allow,deny
Allow from all
</Directory>
Good Luck!

Related

Laragon auto Vartual host file gets reset on refresh

hi I have many sites that I want to test on local, so when I edit the files on auto virtual host files under Apache->sites-enabled->file name, after reloading laragon, the file resets to its original default contents, ex-
Original
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Require all granted
</Directory>
edited
<VirtualHost 192.168.1.101:80>
DocumentRoot "C:/laragon/www/cast.see.tech/public"
ServerName cast.see.tech.test
ServerAlias *.cast.see.tech.test
<Directory "C:/laragon/www/cast.see.tech/public">
AllowOverride All
Order Deny,Allow
Allow from all
Require all granted
</Directory>
I cannot save any rules, any code, it comes back to its default original content once I restart laragon server. I am using windows 11, but the same problem I face on windows 10 also.
I tried uninstalling and installing back, but still no luck. Currently i am using latest version of laragon 5.0.0 210523, I also tried downgrading the version but still the same problem. Is it a windows issue or do I need to do something else. Please help me with this issue.
Each project has each own Virtual Host file located in:
For Apache:
{LARAGON_ROOT}\etc\apache2\sites-enabled\auto.{project}.test.conf
For Nginx:
{LARAGON_ROOT}\etc\nginx\sites-enabled\auto.{project}.test.conf
Content of a .conf file is auto generated. If you have a specific project which has modified content, just remove the auto. prefix from config file names eg : auto.example.test.conf => example.test.conf , Laragon will keep the content of the .conf file intact.
Virtual Host content is configurable, you can change it by modifying the template in:
{LARAGON_ROOT}\usr\tpl\VirtualHost.tpl
https://laragon.org/docs/pretty-urls.html
Laragon uses a template to auto-generate the virtual hosts.
On windows, the file is located at C:\laragon\usr\tpl\VirtualHost.tpl, assuming you installed it in C:\laragon.
Just edit this file and make the changes you want.
Keep in mind that all your sites will now use the same configurations.
One change I personally make is to remove the *. from ServerAlias, as I use subdomain format for my sites. Before I remove it, subdomain.example.com would always redirect to example.com.

500 server error when submitting form but no logs were found

I have a site that has a signup form , can be accessed here
Everytime i try to submit the POST it returns back as a 500 error, however when i tried to check the server error logs.. i find it empty
for some reason i kind of suspect it has to do with my apache2 setup as this is a codecanyon base code, so i doubt there is an error in the code.. here's what i have in my virtual host config
<VirtualHost *:80>
ServerName siral.marketing
#ServerAlias www.siral.marketing
ServerAdmin webmaster#localhost
DocumentRoot /var/www/smmpanel
<Directory "/var/www/smmpanel">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
AllowOverride All
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/smmpanel_error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I think it's not an issue with the apache. If you using Codeigniter please check the file name and class names (check all models and the controllers). Because those are case-sensitive on production servers. On the local machine, it may not show this error.
When you're using FTP for this scenario, try to delete the destination file first on the remote machine and then copy the new file to the server. Because sometimes replacing or rename may not work properly for change the letter case of the same name.
I have tested the URL you have given, looks like its only a modal file is missing. Unable to locate the model you have specified: Payments_model.
Check the screenshot for better idea.
Try the firefox network tab while submitting your form.
Also check the file and complete directory name or you can paste the code in your question.
It is possible that access rights for cache or log file folders are not set correctly.

How to access http://localhost/~username/Sites folder from iPhone which is connected to the same network

I'm not using WAMP or MAMP, I'm just using the inbuilt web server on mac. I have all my websites developed on http://192.xxx.x.x/~username/Sites folder and need to access some of them in my iPhone.
I found my mac's ip address (192.xxx.x.x) and entered it on my iPhone and it's working fine. But when I enter http://192.xxx.x.x/~username/Sites it says,
Forbidden, you don't have permission to access this resource.
Is this something to do with Firewall ?
It might be because of permision issues,
You should check your etc/apache2/users there check username.conf.
If there is no username.conf , get your short username and create a file shortusername.conf.
Use whoami to get short username, e.g my username is San create San.conf at that location..
Use sudo nano shortusername.conf to edit file and add this bit
<Directory "/Users/username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
Now restart your server by :
sudo apachectl restart
This worked for me...

Apache stop webdav directory listing on windows

I'm working on a server which has to serve a few files publically via WebDav. The public availability and WebDav is a must have, so I can't just change them. Windows support (sadly) is another must thing...
It would be great if I could disable directory listing, so the person who I give the webdav link would only be able to either guess the link or use only the one I gave.
In default case it's quite easy to disable directory listing, and in the browser the current configuration perfectly stops dir listing, but when I open it via windows explorer, I can easily see the whole directory and its content. My current config is:
<VirtualHost *>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/web1/web/
<Directory /var/www/web1/web/>
Options MultiViews
AllowOverride None
Order allow,deny
allow from all
<LimitExcept GET PROPFIND>
Require valid-user
</LimitExcept>
</Directory>
Alias /v1 /var/www/web1/web
<Location /v1>
DAV On
AuthName "webdav"
</Location>
</VirtualHost>
If I wont allow PROPFIND method, windows thinks that the host is unavailable (unsure if linux can access it, that's not my target).
Is it possible to stop directory listing on windows? For me it seems the PROPFIND is what causes this, but I'm unsure if I can somehow bypass this problem. Do you have any idea how should I modify my config file?
I know this question is old, but in your VirtualHost file (the file in /etc/apache2/sites-available/[yoursite].conf), you need to add something. This is in your directory tag. Supply it with DirectoryIndex disabled. Like this
<Directory [yourdirectory]>
(...)
DirectoryIndex disabled
</Directory>
Sincerly, Chris Fowl

Apache 403 when hitting name.local Yosemite

This is the first time I'm setting up an apache web server, I'm doing this on my Mac with OS X Yosemite. For some reason I'm receiving 403 errors when I try to hit my user directory via the browser with the formate computerName.local. When I hit the default directory with that same format I get the "It works!" page, but when I try to hit my user directory it gives me the "Forbidden" error... If I hit it with localhost everything works fine, but I'm trying to hit it from my iPhone hence the localhost won't work from there...
I've tried every guide I could find, tried setting the vhosts configuration file (but when I do so the browser can't reach the folder even when trying localhost), I tried changing the httpd.conf file to have "Require all granted" on a new with the path to my user sites directory... Can anyone tell me if I'm doing something wrong? If you need I could upload my httpd.conf and httpd-vhosts.conf files (or any other related file that may need configuration).
Thanks!
Found the issue. It took me a while but it was really simple at the end. On my User conf file /private/etc/apache2/users/USERNAME.conf there was a line that was absolutely responsible for the behavior that from localhost everything worked fine but from computerName.local it wouldn't. This is what the file looked like:
<Directory "/Users/Santiago/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from localhost
Require all granted
</Directory>
All I had to do was change that "Allow from localhost" to "Allow from all" and restart apache. Everything works now.

Resources