Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get localhost running on mac OS X Yosemite

I have updated my OS to Yosemite and the only issue I have is that my localhost is not working anymore. Please excuse if the questions sounds dumb but I have limited knowledge about servers.

with Mavericks I was able to use localhost and customdomain.dev right after a system start. Also my MySQL server has been started without any actions

Now Google Chrome throws an ERR_CONNECTION_REFUSED error when using localhost.

I run

apachectl configtest

which returns

httpd: Syntax error on line 58 of /private/etc/apache2/httpd.conf: Cannot load libexec/apache2/mod_authn_default.so into server: dlopen(/usr/libexec/apache2/mod_authn_default.so, 10): image not found

if I comment out this line it continues with other modules. When I comment out all modules which causes this syntax error I get

AH00526: Syntax error on line 131 of /private/etc/apache2/httpd.conf:
Invalid command 'User', perhaps misspelled or defined by a module not included in the server configuration

I'm using the httpd.conf file from Mavericks (where everything worked fine)

I have no idea what I should do next

like image 851
Xaver Avatar asked Oct 19 '14 18:10

Xaver


People also ask

Does macOS have a Web server?

Apache Web Server Most Mac users don't realize it, but macOS comes with its own built-in web server. Apache is an open-source web server that has been available since 1995, and as of 2016, it was the engine behind 46% of all websites and 43% of the top million websites in terms of traffic.

How do I run a server on a Mac?

On your Mac, do any of the following: Choose Apple menu > Recent Items, then choose from the list of recent servers. In the Finder , choose Go > Connect to Server, click the pop-up menu to the far right of the Server Address field, then choose a recent server.

What is localhost in Finder?

Here's one definition of localhost you may find: “The localhost is the default name describing the local computer address also known as the loopback address. For example, typing: ping localhost would ping the local IP address of 127.0. 0.1 (the loopback address).


2 Answers

Did you retain your original httpd.conf from before the upgrade? You may have to edit the modules in your httpd.conf

I found that an Apache upgrade came along with Yosemite. Apparently there are several authentication-related changes from Apache 2.2 to 2.4. I had to run sudo apachectl configtest repeatedly to display which modules to remove.

Then, I had to add some modules. My modules look like this now:

LoadModule authn_file_module libexec/apache2/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
#LoadModule authn_default_module libexec/apache2/mod_authn_default.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
#LoadModule authz_default_module libexec/apache2/mod_authz_default.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
LoadModule cache_module libexec/apache2/mod_cache.so
#LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
#LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
LoadModule dbd_module libexec/apache2/mod_dbd.so
LoadModule dumpio_module libexec/apache2/mod_dumpio.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule filter_module libexec/apache2/mod_filter.so
LoadModule substitute_module libexec/apache2/mod_substitute.so
LoadModule deflate_module libexec/apache2/mod_deflate.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
LoadModule logio_module libexec/apache2/mod_logio.so
LoadModule env_module libexec/apache2/mod_env.so
LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
#LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so
LoadModule expires_module libexec/apache2/mod_expires.so
LoadModule headers_module libexec/apache2/mod_headers.so
#LoadModule ident_module libexec/apache2/mod_ident.so
LoadModule usertrack_module libexec/apache2/mod_usertrack.so
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
#LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
LoadModule mime_module libexec/apache2/mod_mime.so
LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
LoadModule asis_module libexec/apache2/mod_asis.so
LoadModule info_module libexec/apache2/mod_info.so
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
LoadModule imagemap_module libexec/apache2/mod_imagemap.so
LoadModule actions_module libexec/apache2/mod_actions.so
LoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
#LoadModule perl_module libexec/apache2/mod_perl.so
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
LoadModule access_compat_module libexec/apache2/mod_access_compat.so
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so

You'll see that I commented out a few. There are a few new ones. The two _core_ ones, unixd_module, and access_compat_module are new. Don't mind the strange looking PHP module. That's from Homebrew's PHP.

I also had to remove the LockFile directive in httpd-mpm.conf. And the NameVirtualHost directive in httpd-vhosts.conf.

I hope this helps.

like image 103
Stephen Farmer Avatar answered Oct 03 '22 06:10

Stephen Farmer


Since Mac OSX 10.10 Yosemite the Web Sharing option located previously in Settings -> Sharing ceased to exist, now manual configuration is necessary.

check this link: http://ole.michelsen.dk/blog/setup-local-web-server-apache-php-osx-yosemite.html

like image 29
Jorgesys Avatar answered Oct 03 '22 04:10

Jorgesys