Lamp where is d.conf




















This can be configured using our initial server setup guide for Ubuntu The Apache web server is among the most popular web servers in the world.

Start by updating the package manager cache. UFW has different application profiles that you can leverage for accomplishing that.

To list all currently available UFW application profiles, you can run:. It should look something like this:. If you see this page, then your web server is now correctly installed and accessible through your firewall. Usually, this is the address you use to connect to your server through SSH. There are a few different ways to do this from the command line. First, you could use the iproute2 tools to get your IP address by typing this:. This will give you two or three lines back.

They are all correct addresses, but your computer may only be able to use one of them, so feel free to try each one. An alternative method is to use the curl utility to contact an outside party to tell you how it sees your server.

This is done by asking a specific server what your IP address is:. Now that you have a web server up and running, you need to install the database system to be able to store and manage data for your site. This script will remove some insecure default settings and lock down access to your database system.

Start the interactive script by running:. Note: Enabling this feature is something of a judgment call. It is safe to leave validation disabled, but you should always use strong, unique passwords for database credentials. Keep in mind that if you enter 2 for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words. This is not to be confused with the system root.

The database root user is an administrative user with full privileges over the database system. Even though the default authentication method for the MySQL root user dispenses the use of a password, even when one is set , you should define a strong password here as an additional safety measure.

This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made. This will connect to the MySQL server as the administrative database user root , which is inferred by the use of sudo when running this command.

Basically, it will organize and provide access to databases where your site can store information. Note : In this case, you do not have to run sudo apt update prior to the command. This is because you recently ran it in the commands above to install Apache. The package index on your computer should already be up-to-date. Enter Y to continue. When the installation is complete, run a simple security script that comes pre-installed with MySQL which will remove some dangerous defaults and lock down access to your database system.

Start the interactive script by running:. Note: Enabling this feature is something of a judgment call. This will cause issues if you use a weak password in conjunction with software which automatically configures MySQL user credentials, such as the Ubuntu packages for phpMyAdmin. It is safe to leave validation disabled, but you should always use strong, unique passwords for database credentials.

Keep in mind that if you enter 2 for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words. This is not to be confused with the system root. The database root user is an administrative user with full privileges over the database system. Even though the default authentication method for the MySQL root user dispenses the use of a password, even when one is set , you should define a strong password here as an additional safety measure.

This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes you have made.

This will connect to the MySQL server as the administrative database user root , which is inferred by the use of sudo when running this command. You should see output like this:. Even though this might look like a security concern at first, it makes the database server more secure because the only users allowed to log in as the root MySQL user are the system users with sudo privileges connecting from the console or through an application running with the same privileges.

Your MySQL server is now installed and secured. PHP is the component of your setup that will process code to display dynamic content. It can run scripts, connect to your MySQL databases to get information, and hand the processed content over to your web server so that it can display the results to your visitors. Once again, leverage the apt system to install PHP. Run the following command to install all three packages and their dependencies:. Currently, if a user requests a directory from the server, Apache will first look for a file called index.

We want to tell the web server to prefer PHP files over others, to make Apache look for an index. To make this change, open the dir. Move the PHP index file highlighted above to the first position after the DirectoryIndex specification, like this:.

After this, restart the Apache web server in order for your changes to be recognized. You can do that with the following command:. You can also check on the status of the apache2 service using systemctl :. To extend the functionality of PHP, you have the option to install some additional modules. To see the available options for PHP modules and libraries, pipe the results of apt search into less , a pager which lets you scroll through the output of other commands:.

Ubuntu provides two small utilities that take care of this: a2ensite a pache 2en able site and a2dissite a pache 2dis able site. It is working! Troubleshooting PHP 5 Does your browser ask if you want to download the php file instead of displaying it? If Apache is not actually parsing the php after you restarted it, install libapache2-mod-php5. It is installed when you install the php5 package, but may have been removed inadvertently by packages which need to run a different version of php.

Be sure to clear your browser's cache before testing your site again. If the problem persists, check your PHP file authorisations it should be readable at least by Ubuntu user "apache" , and check if the PHP code is correct.

If this doesn't work, then it is a problem of file authorisation, Apache or PHP configuration, cache not emptied, or Apache not running or not restarted. Use the display of that test file in your web browser to see the list of files influencing PHP behaviour. So if you e. If you want to debug your scripts, it might be better to use the "development" settings. To make the "development" settings active, just backup your original php. See the blog for instructions on how to change this back.

After installing MySQL Set mysql bind address Before you can access the database from other computers in your network, you have to change its bind address. Note that this can be a security problem, because your database can be accessed by other computers than your own. Skip this step if the applications which require mysql are running on the same machine. If you try to connect without changing the bind-address you will recieve a "Can not connect to mysql error ".



0コメント

  • 1000 / 1000