Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of LAMP Environment Construction

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Why do you need to go to the official website to download the source package?

To put it simply, it is for security. If it is an unofficial downloaded source package, it may be tampered with by people with ulterior motives. After all, it is source code, and anyone can modify the code.

2. Can 32-bit rpm packages be installed on 64-bit machines? Can a 64-bit machine install a 32-bit mysql binary compiler-free package?

32-bit rpm packages can be installed on 64-bit machines, and 32-bit mysql binary uncompiled packages can be installed on the same 64-bit machines (centos5.x does support it, but centos6.x does not).

3. When compiling and installing apache, what is the problem if you don't add-with-included-apr?

Will report an error, Cannot use an external APR with the bundled APR-util, because apr is an underlying interface library, compiling apache must have this support.

4. When compiling php, you must add-with-apxs2=/usr/local/apache2/bin/apxs. What does that mean?

Apxs is a tool that apache compiles dynamic modules and automatically configures and loads them into httpd.conf files. Because php is also a dynamic loading module of apache, the purpose of compiling php is to generate this module, so we must specify the address of apxs.

5. After configuring the configuration file for apache, how to verify that the configuration file is correct?

/ usr/local/apache2/bin/apachectl-t

6. How do I see if port 80 is started?

Netstat-lnp | grep': 80'

7. After changing the apache configuration file httpd.conf, how do I reload the configuration file?

/ usr/local/apache2/bin/apachectl graceful

8. How do I see which modules are loaded in apache?

/ usr/local/apache2/bin/apachectl-M

9. How do I see which modules are loaded in php?

/ usr/local/php/bin/php-m

10. Briefly describe the difference between static loading and dynamic sharing modules.

Whether you compile httpd or php, there is a concept of static and dynamic modules. First of all, the macro analysis of the dynamic and static modules shows that the static will be compiled directly into the executable file httpd, while the dynamic module is a separate file; secondly, the static module is loaded with the httpd file, and all static modules are loaded as soon as the service is opened, while the dynamic module is loaded according to when and when it is needed.

11. After we have configured the lamp environment, the access php program cannot be parsed. How can you troubleshoot this problem?

(1) apachectl-M to see if libphp5.so is loaded

(2) if it is not loaded, check whether / usr/local/apache2/modules/ has libphp5.so, and then check whether there is LoadModule libphp5.so in httpd.conf.

(3) check whether there is AddType application/x-httpd-php .php in httpd.conf.

(4) apache must restart the service.

twelve。 How to configure a virtual host for apache (Apache's main configuration file: / usr/local/apache2/conf/httpd.conf)

Vim httpd.conf

# Include conf/extra/httpd-vhosts.conf

Remove the first # of the line, and then modify:

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

Change to

Options FollowSymLinks

AllowOverride None

Order deny,allow

Allow from all

Then vim conf/extra/httpd-vhosts.conf modifies it according to the actual demand

13. How to configure user authentication for apache

Vi httpd.conf

In the corresponding virtual host profile section, add

AllowOverride AuthConfig

AuthName "Custom"

AuthType Basic

AuthUserFile / data/.htpasswd / / you can write any directory you like. There is no limit.

Require valid-user

After saving, create the authenticated user htpasswd-c / data/.htpasswd test for apache

14. How to configure the log of apache and how to cut the log by day

In httpd.conf, in the corresponding virtual host configuration section, add

CustomLog "| / usr/local/apache2/bin/rotatelogs-l / usr/local/apache2/logs/www.yourdomain.com-access_%Y%m%d.log 86400" combined

Note that it needs to be written as an absolute path, and a relative path may not be valid.

15. How to configure the expiration time of static files such as pictures of apache

Add to httpd.conf

ExpiresActive on

ExpiresByType p_w_picpath/gif "access plus 1 days"

ExpiresByType p_w_picpath/jpeg "access plus 24 hours"

ExpiresByType p_w_picpath/png "access plus 24 hours"

ExpiresByType text/css "now plus 2 hour"

ExpiresByType application/x-javascript "now plus 2 hours"

ExpiresByType application/x-shockwave-flash "now plus 2 hours"

ExpiresDefault "now plus 0 min"

16. How to restrict that php files in a directory do not have execute permissions

Vim httpd.conf

In the relevant virtual host segment, add

Php_admin_flag engine off

Where / www/htdocs/path is the directory to be restricted

17. How to configure domain name redirection for apache

To forward the domain name that accesses the domain name www.domain1.com to www.domain2.com

Achieve:

Add to the relevant virtual hosts

RewriteEngine on

RewriteCond% {HTTP_HOST} ^ www.domain1.com$

RewriteRule ^ (. *) $http://www.domain2.com/$1 [Rust 301m L]

If multiple domain names are redirected to one domain name

RewriteEngine on

RewriteCond% {HTTP_HOST} ^ www.domain.com [OR]

RewriteCond% {HTTP_HOST} ^ www.domain1.com$

RewriteRule ^ (. *) $http://www.domain2.com/$1 [Rust 301m L]

18. How to configure the error log for php

Vim php.ini checks and configures the following two items

Log_errors = On

Error_log = logs/error.log

19. How do I configure open_basedir in php, and can I configure open_basedir for virtual hosts in httpd.conf?

Vim php.ini

Join open_basedir=/var/www/

You can also restrict openbasedir for virtual hosts in httpd.conf:

Add the following to the corresponding virtual host profile:

Php_admin_value open_basedir "/ var/www/htdocs"

20. How to disable the function exec of php

Vim php.ini found

Disable_functions =

Change to

Disable_functions = exec if it is multiple functions, you can continue to add function names after exec and separate them with commas.

21. When we install the LAMP environment with source code, which one should be installed first and which one should be installed later? Why?

The installation order can be mysql apache php or apache mysql php

Put php at the end because when you install php, you need to specify the mysql installation directory and the apxs tool for apache

twenty-two。 How to determine which directory your php.ini is in?

Php-I | grep 'Configuration File'

23. How do you know where your php extension_dir is?

Php-I | grep 'extension_dir'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report