XAMMP. Object not found! Error 404 localhost - php

I just installed XAMPP on my Mac. After configured everything and tried to run myProject on localhost 8080 the following error showed up on the web.
localhost:8080/myProject
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.46 (Unix) OpenSSL/1.1.1g PHP/7.4.9 mod_perl/2.0.11 Perl/v5.32.0
Here's the configurations for XAMPP
Here's the files under htdocs
Document root:
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
Include etc/extra/httpd-xampp.conf
Include "/opt/lampp/apache2/conf/httpd.conf"
httpd.xampp.conf
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 >/error/XAMPP_FORBIDDEN.html.var
</Directory>
apache2/conf/httpd.conf
Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"
<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
etc/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" >common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" >common
</VirtualHost>
<VirtualHost laravel.local:80>
DocumentRoot "
/Users/phamminh/.bitnami/stackman/machines/xampp/volumes/root/htdocs/myProject/public"
ServerAdmin laravel.local
<Directory "
/Users/phamminh/.bitnami/stackman/machines/xampp/volumes/root/htdocs/myProject">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Related

Unable to connect to apache virtualhost

I have unizped codeigniter on /var/www/control_cuotas indx.php is placed on that folder and I settrd up a new virtualhost on apache on the 000-default.conf file whith this code
<VirtualHost *:81>
<Directory /var/www/control_cuotas>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/control_cuotas
ServerAlias www.control_cuotas.test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But I cannot acces to localhost:81 its Unable to connect and the serve rwas restarted before I tried to access
For example:
<VirtualHost *:80>
ServerName your_project
DocumentRoot "C:/wamp64/www/your_project"
<Directory "C:/wamp64/www/your_project/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Let's try one more time.
Make sure all your VirtualHosts define a ServerName. Failure to do so will mean trouble as you add more hosts.
<VirtualHost *:80>
DocumentRoot /var/www/control_cuotas
ServerName control_cuotas.test
ServerAlias www.control_cuotas.test
ServerAdmin webmaster#localhost
<Directory /var/www/control_cuotas>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Don't forget to enable the above config in Apache adding it to the sites-enabled list. Then restart Apache.
The file /etc/hosts should look like this at a minimum
127.0.0.1 localhost
127.0.0.1 control_cuotas.test
127.0.0.1 www.control_cuotas.test
Other VHosts should also be represented in this file.
You can also add entries for ipV6 if you want, but it is not a requirement in most cases. (The main case is that you have disabled communication using ipV4.)

when i enter domain name http://oj.mbstu.ac.bd into browser then next it redirect to IP http://103.28.121.75/index.do why?

<VirtualHost *:80>
ServerName oj.mbstu.ac.bd
ServerAlias www.oj.mbstu.ac.bd
ServerAdmin webmaster#oj.mbstu.ac.bd
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/etc/hosts
127.0.0.1 oj.mbstu.ac.bd
103.28.121.75 oj.mbstu.ac.bd
<VirtualHost *:80>
ServerAdmin yourname#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
This is the proper configuration, but as i can see your document root /var/www/ includes the html, just remove the conf document and include you own index.
Then just restart the apache server
sudo service apache2 reload

Accessing web site by HTTPS is breaking database connection

I have a codeigniter site running on a Apache web server
I installed an SSL from letsencrypt
My site works fine if I access it through http://example.com
but,
If I access it through https://example.com the site shows but the database is broken
This is my htaccess file
Include /etc/phpmyadmin/apache.conf
<VirtualHost *:80>
ServerName example.org
ServerAlias www.example.org
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
RewriteEngine on
RewriteRule "^/resources/(.+)" "https://example.org/_resources/$1"$
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ProxyPass /api https://localhost:8010/api
ProxyPassReverse /api https://localhost:8010/api
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.org
ServerAlias www.example.org
DocumentRoot /var/www/html/
Include /etc/letsencrypt/options-ssl-apache.conf
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.org-0001/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.org-0001/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.org-0001/chain.pem
</VirtualHost>
Fixed this issue by adding inside of the <VirtualHost *:443> tag
<Directory /var/www/html>
AllowOverride All
</Directory>

Wamp : You don't have permission to access file.html on this server

I tried to create a virtualhost to access to my local website using wampserver, but i get a 403 Forbidden when i'm trying to access to the webpage :
I put the following line in my browser :
mywebsite/html/start.html
Here is the content of my httpd-vhost file :
<VirtualHost *:80>
ServerName mywebsite
DocumentRoot "D:\pathToMySite"
<Directory "D:\pathToMySite">
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
I put the alias also in my host file :
127.0.0.1 mywebsite
I will share my httpd.conf for AMPPS under windows(should be very similar to wamp)
<VirtualHost 127.0.0.1:80>
<Directory "{$path}/www">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
ServerName localhost
ServerAlias localhost 127.0.0.1
ScriptAlias /cgi-bin/ "{$path}/www/cgi-bin/"
DocumentRoot "{$path}/www"
ErrorLog "{$path}/apache/logs/error.log"
CustomLog "{$path}/apache/logs/access.log" combined
</VirtualHost>
<VirtualHost *:80>
<Directory "F:/www">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
DocumentRoot "F:/www"
ServerName site1.com
</VirtualHost>
I also use host file for local DNS
127.0.0.1 site1.com
hope that helps !

Cannot navigate to laravel project via localhost using Apache

I installed a laravel project to /home/user/development. The project is called rpm (/home/user/development/rpm). I also have another project that I have been using at /home/public_html. It's called mgmt (/home/user/public_html/mgmt). I can navigate just fine to mgmt via localhost/mgmt. It's conf file in sites-available is
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/public_html/
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
Now my laravel project (rpm) does not work. Navigating to localhost/rpm gives a 404.
It's conf file looks like this
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/development/rpm/public/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
What could be the problem here? Both of those config files have symlinks in the sites-enabled folder.
Modify the first conf to this. Discard the second conf.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/public_html/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>

Categories