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

The method of Security setting of Apache and PHP under Linux

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge about "Apache and PHP security settings under Linux". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to handle these situations! I hope you can read carefully and learn something!

(1)safe_mode: Run php in safe mode;

Use the following in the php.ini file

safe_mode = on

safe_mode = off

The corresponding setting method for virtualhost in httpd.conf of apache

php_admin_flag safe_mode on

php_admin_flag safe_mode off

Or:

php_admin_value safe_mode 1 (use safe mode)

php_admin_value safe_mode 0

(2)safe_mode_include_dir: directories without uid/gid checking;

(3)open_basedir: limits user-operable files to a directory;

a. Set the directory in httpd.conf of apache:

php_admin_value open_basedir /usr/local/apache/htdocs/:/tmp/

b. Set open_basedir = .:/in php.ini tmp/, this setting indicates permission

Access the current directory (i.e. the directory where the php file is located) and/tmp/directory.

(4)disable_functions: Set disabled functions

Typical Security Configuration

disable_functions = shell_exec,system,exec,passthru,show_source,get_cfg_var,dl

If you allow the user to debug the program, configure it as follows:

disable_functions = shell_exec,system,exec,passthru

(5)register_globals: prohibits registering globals;

register_globals = on (automatically registered as global variable)

register_globals = off

(6)magic_quotes_gpc: escape sensitive characters

magic_quotes_gpc = on

magic_quotes_gpc = off

In Apache httpd.conf, configure virtualhost accordingly:

php_admin_flag magic_quotes_gpc on

Or:

php_admin_value magic_quotes_gpc 1

"Apache and PHP security settings under Linux" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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

Internet Technology

Wechat

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

12
Report