Apache and PHP are installed in the docker image. How to configure the virtual domain name of this machine, you can access curl www.test.com. I have configured the hosts file and httpd.conf, but it is still useless. How do I configure it?
You'll have to edit /etc/hosts and add this :
127.0.0.1 www.test.com
By eg you can do this in your dockerfile :
RUN echo "127.0.0.1 www.test.com" >> /etc/hosts
(or check your docker configuration if there is any option to do it)
Related
I am having debian vagrant. I have done virtual host configuration in its apache as servername https:local-dev02.sitename.com. And used in my windows machine host file 127.0.0.1 local-dev02.sitename.com.
I can access my site in windows' browser as https://local-dev02.sitename.com:8443/.
But I am unable to do
ping https://local-dev02.sitename.com
OR
curl https://local-dev02.sitename.com
OR
wget https://local-dev02.sitename.com
It is only possible to ping a hostname or IP address, but not an URL. So you need to put off the protocol like so
ping local-dev02.sitename.com
To reach your hosts via the hostnames, please add the IPs and hostnames to the /etc/hosts file.
Hie, I am trying to host a Laravel project on a VPS server with Cpanel. I am getting the No input file Specified error when I access the site.
Things I did so far>
Got Managed VPS hosting from inmotionhosting.
Got into root and downloaded the laravel project on var/www/html.
Got a domain name point at the server's Ip address using A.
Changed the virtual host file servername and alias to the domain name keeping the ip address on the top as shown below:
<VirtualHost ipaddress:80>
ServerName mydomain.com
ServerAlias www.domain.com
DocumentRoot var/www/html/laravel/public
</virtualhost>
Now when I access the domain it returns No input file Specified error. I am not sure how to change the .htaccess to get this working, I believe it is something to do with the server .htaccess. I did fiddle around for quite a bit but a no vain so I had to turn to stackoverflow.
Adittionaly I changed my html folder permission and ownership to apache, tested with 755 777, tested with different user name no luck.
Not using vagrant or homestead or forge , Any suggestions
I had a similar issue. While I also edited the Apache configuration and it didn't work, since for me it was PHP-FPM.
For some reason the document root was not changed in /opt/cpanel/ea-php72/root/etc/php-fpm.d/{my-domain-name-here}.conf.
Correcting the document root here is what did the trick. So if you have a PHP-FPM configuration.
Check the document root specified there as well and then restart the FPM service.
You might run this command to restart FPM service:
/scripts/restartsrv_apache_php_fpm
Also don't forget to restart php-fpm service after changing document root,.
In my using in my case was:
systemctl restart ea-php72-php-fpm.service
First time got a new MBP 2016. Trying to setup PHP,MySQL & Apache. Started Apache by using command
sudo apachectl restart
Then installed PHP by
brew install php71 --with-httpd24
Also did following changes...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.html index.php
SetHandler application/x-httpd-php
ServerName dev-server
Also, updated the same in host file /etc/hosts/
But, whenever I'm trying to Stop/Restart my apache by using command sudo apachectl restart or sudo apachectl stop I'm getting following errors.
AH00557: httpd: apr_sockaddr_info_get() failed for Sureshs-MacBook-Pro.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
But, strangely when I'm executing any PHP file from my browser http://localhost/index.php it's working fine. As in my index.php file I'm using code <?php phpinfo(); ?> It's showing PHP version PHP Version 7.1.4 loaded.
Tried a lot but no clude what's going wrong at where.
---UPDATE---
After updating 127.0.0.1 Sureshs-MacBook-Pro.local in my /private/etc/hosts file, one error solved. Now I'm getting only one below error.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Sureshs-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
Finally, I solved this by updating ServerName localhost:8080 on file /usr/local/etc/apache2/2.4/httpd.conf. It was a differnt httpd.conf file which I didn't knew about it.
Also, for Apache start/restart/stop following command sudo /usr/sbin/apachectl start works for me.
As per message:
Set the 'ServerName' directive globally to suppress this message.
You need to identify httpd.conf Apache configuration file by:
apachectl -t -D DUMP_INCLUDES
then edit it and uncomment the line with ServerName (make sure it has the valid server name). E.g.
ServerName localhost
open file httpd.conf
vi /etc/httpd/conf/httpd.conf
add to first line
ServerName localhost
systemctl restart httpd
I resolved this issue changing the port address in the httpd.conf file in windows.
This problem arises due to the port already listening, which we use in the conf file.
To view the port listening, use the command "netview /a"
if the port used in the conf file already listening, change to different one(e.g, 8080)
set servername to "localhost" or 127.0.0.1
Now start the apache server "httpd.exe -k start"
it will work fine.
On macOS Catalina...
Edit the Apache config file
sudo vi /etc/apache2/httpd.conf
Find the ServerName entry by typing a / followed by ServerName and hit enter
Press n to go to the next occurrence until you are on #ServerName www.example.com:80 (keep pressing n if you go past it)
Add a newline by typing an o
Type the following: ServerName localhost
Save and exit by typing !wq then hit enter (or type ZZ which is capital Z twice)
Restart Apache
sudo apachectl restart
I am using wamp (php v 5.5.12, apache v 2.4.9). When I start the apache server the icon becomes green as if everything is fine. I can access to all services with no problem. When I try to add a virtual host to configure in httpd.conf for my symfony project apache will not restart.
<VirtualHost *:80>
DocumentRoot C:\wamp\www\tuto\Symfony\web
<Directory "C:\wamp\www\tuto\Symfony\web">
DirectoryIndex app_dev.php
Options -Indexes FollowSymLinks SymLinksifOwnerMatch
AllowOverride All
Allow from All
</Directory>
</VirtualHost>`
The server icon then stays in yellow instead of green and I can't access to localhost url. When I remove my config, everything becomes normal again. Please help me to understand how I can resolve this.
You have a single-quote at the end of:
</VirtualHost>`
Remove it.
You can use the symfony 2 built in server . first undo any changes on your httpd.conf
open your cmd and do this:
cd C:\wamp\www\tuto\Symfony\web
next
php app/console server:run
now try this on your browser: http://127.0.0.1:8000
this is equal to : http://localhost/tuto/Symfony/web/app_dev.php
if you want to start web server on your local ip use this
php app/console server:run yourIP:port
It's solved, thank you guys !
What I did :
1-Adding my conf in httpd-vhost.conf with ServerName parameter
ServerName www.project.com inside section as #skrilled said.
2-In the httpd.conf, Uncomment this line : Include conf/extra/httpd-vhosts.conf
3-In the system file "hosts", I added this line : 127.0.0.1 www.project.com
I have just started using laravel and a mac to develop websites. I have gone through the setup and tried following a phpacademy tutorial.
My problem is that when i try and access the localhost, as default i get the index page where all my folders are stored and when i enter my direct path e.g. laravelpractice.local in the web browser i get the error that i mentioned in the title.
i have edited the /etc/apache2/httpd.conf and the /etc/hosts to create a virtual host and create a custom url respectively and the spelling seems to be fine.
/etc/hosts file open. You must be the owner of the file.
127.0.0.1 localhost.localdomain localhost
after add
127.0.0.1 laravelpractice.local
000-default.config file save. After /etc/apache2/sites-enabled/000-default.config file open. You must be the owner of the file. Add to the bottom
<VirtualHost *:80>
DocumentRoot "/var/www/laravelpractice/public/"
ServerName laravelpractice.local
</VirtualHost>
Apache restart with terminal:
sudo service apache2 restart
Open browser and url : laravelpractice.local