XAMPP basic Configuration tips for Linux (setting up a virtual host, adding an FTP account, etc.)

Source: Internet
Author: User
Tags ftp file

XAMPP basic Configuration tips for Linux (setting up a virtual host, adding an FTP account, etc.)

XAMPP installed after the only one default site and a default nobody FTP account, which is clearly not in line with our usual needs, then the following is how to set up and manage multiple virtual hosting and FTP accounts, as for the XAMPP installation is not discussed in this area, Readers can refer to the official website for their own instructions.

1, first of all, the configuration of the FTP account:

XAMPP uses the PROFTPD server, this is not like in our win environment commonly used serv-u, user accounts are not configured in the Server tool, but in the Linux system account configuration. So we can use the command:

Groupadd ftpusers

First in the system to create a user group named Ftpusers, where the name can be arbitrarily set, mainly to distinguish between the FTP account and the system other types of accounts so I named Ftpusers here, and then add a user in this group:

useradd-d/opt/lampp/www/site1-g ftpusers-s/sbin/nologin site1ftp

The first parameter,-D, represents the user home directory, where/opt/lampp/www/must be present, and Site1 is created automatically when the command executes. The second parameter,-G, indicates which user group this user belongs to, and the third parameter-s represents the user's shell environment, which we should set as an unlicensed path for security reasons. The last parameter is the login name for this account, and here I am site1ftp.

Once created, we will set a password for the account:

passwd site1ftp

After executing this command, press the prompt to enter the password two times to complete the account site1ftp password settings.

Next we set the permissions for the account home directory:

Chmod-r 777/opt/lampp/www/site1

At this point, the addition of the FTP account is completed, by the way, the command to delete the account is Userdel, the command to modify the account is Usermod, the file path of the storage account is/etc/passwd.

Also, for security reasons, we should modify the Defaultroot to ftpusers in the PROFTPD service profile (the general path is/opt/lampp/etc/proftpd.conf). Restrict user access within the Ftpusers group to their home directory. You can also set the Defaultroot to ~ (the symbol in the upper-left corner of the keyboard), which means that all users in the group have this limitation. If you want to set up two or more groups individually, you must start with a different line or lines, as described below:

Defaultroot ftpusers #限制ftpusers组里面的用户
Defaultroot ~ #限制所有组里面的用户
Defaultroot Ftpusersdefaultroot Nobody #限制ftpusers组及nobody组里面的用户
Defaultroot Ftpusers,nobody #限制既隶属于ftpusers组同时也隶属于nobody组里面的用户

Yes, one more step. You should add overridable permissions to the FTP directory in the PROFTPD configuration file, as follows:

<Directory/opt/lampp/www/*> AllowOverwrite on</directory>

Otherwise, an issue with files with the same name cannot be overwritten when the ftp file is uploaded.

2, then let's talk about the configuration of the virtual host
Execute First:

Cat/opt/lampp/etc/httpd.conf

Looking at the Apache configuration file for Xampp, we found one line:

#Include etc/extra/httpd-vhosts.conf

It seems that XAMPP has prepared a file dedicated to configuring the virtual host, removing the # number to remove its comments, and then editing the/opt/lampp/etc/extra/ httpd-vhosts.conf file, this file xampp for us to create a sample of two virtual hosts, we commented out the two examples, and then add our own required virtual host, for example:

<virtualhost *:80> documentroot/opt/lampp/www/site1 ServerName blog.ewebe.net</virtualhost>

DocumentRoot represents the path to the virtual host, the site directory, and servername represents the access address of the virtual host, similar to the host header value in IIS.

At this point, the setup of the virtual host is complete.

Finally, we need to add access to the site directory in the Apache configuration file/opt/lampp/etc/httpd.conf.

<directory "/opt/lampp/www/site1" > Options Indexes followsymlinks allowoverride all Order allow,deny all ow from all</directory>

Here you can change the directory path/opt/lampp/www/site1 to/opt/lampp/www, for later build more virtual host such as Site2, site3 ... Wait for it to be ready.


XAMPP basic Configuration tips for Linux (setting up a virtual host, adding an FTP account, etc.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.