When using apache to build a PHP development environment, we often encounter situations where the port is occupied. We can kill the process using port 80 or modify the default port 80 of apache. The following article will introduce to you how to modify the apache port. I hope it will be helpful to you.
Steps to change the apache port:
1. Go to the apache installation directory
2. Enter the apache configuration file directory conf
3. Right-click to edit the apache configuration file httpd.conf
5. Use ctrl f to quickly search for Listen
. Go to the Listen 80 line and change 80 to another unoccupied port number. I changed it to 90 here and saved the current changes.
6. Restart apache to make the new configuration take effect.
Click "Start" > "Run" > Enter cmd > Enter > Navigate to the apache installation directory to the bin directory, and then enter the "httpd-k start" command.
7 , after opening the browser, you can access it through 127.0.0.1:90
The above is the detailed content of How to change apache port. For more information, please follow other related articles on the PHP Chinese website!

UsesystemctlformodernLinuxsystems:sudosystemctlstart/restart/stopapache2(Debian/Ubuntu)orhttpd(CentOS/RHEL),andsystemctlstatustocheck.2.Onoldersystems,useserviceapache2/httpdstart/stop/restart.3.Useapachectlstart/stop/restart/gracefulforcross-platfor

Stop immediately after the Apache service is started is usually caused by configuration errors, port conflicts or lack of dependencies. First, check the error log location problem: 1. Check xampp\apache\logs\error.log in Windows system, check /var/log/apache2/error.log or /var/log/httpd/error_log to find the [error] or [crit] level log; 2. The most common reason is port conflicts. Use the netstat command to check port 80 or 443, which can be solved by changing the Apache listening port to 8080 or terminating the occupied process (such as Skype, IIS).

First, check whether the ErrorLog directive in the Apache configuration file is correctly set and not commented, and whether the path is accessible; 2. Ensure that the permissions and ownership of the log files and directories are correct, and that Apache must have write permissions (such as www-data); 3. Check whether security modules such as SELinux or AppArmor block log writing, and adjust the policy if necessary; 4. After modifying the configuration, restart the Apache service and trigger error test log recording; 5. Check the disk space and inode usage to ensure that it is not exhausted; 6. Check whether the system logs such as journalctl or syslog have permission denied or the log cannot be opened; 7. Confirm that the Apache service is

Install Apache and PHP: Use sudoaptininstallapache2phplibapache2-mod-php on Ubuntu/Debian, use sudoyumininstallhttpdphp or sudodnfininstallhttpdphp on CentOS/RHEL; 2. Enable PHP module: It is usually automatically enabled on Debian/Ubuntu, and can be verified through apache2ctl-M|grepphp. If the available sudoa2enmodphp version number is not enabled and Apache is restarted, CentOS needs to ensure /etc/httpd/conf.d

EnsuretheHTTPvirtualhostonport80iscorrectlyconfiguredwithaRedirectdirectiveorRewriteRuletoHTTPS;2.Confirmmod_aliasormod_rewriteisenabledusingsudoa2enmodaliasorsudoa2enmodrewriteandrestartApache;3.VerifyApacheislisteningonport80bycheckingListen80inpor

First,usesudolsof-i:80ornetstattoidentifytheprocessoccupyingport80or443.2.Then,stoptheconflictingprocessusingkill-9onLinux/macOSortaskkill/PID/FonWindows,targetingcommonculpritslikeNginx,Skype,orIIS.3.Optionally,changeApache’sportbyeditingthehttpd.co

SettheServerNameinApacheConfigurationbyopeningthemainconfigfile,typicallylocatedat/etc/httpd/conf/httpd.confor/etc/apache2/apache2.conf,andaddServerNamelocalhost:80oryourdomain,thenrestartApachetoresolvetheAH00558warning.

EnsuretheCGImoduleisenabledinApacheusinga2enmodcgiorloadingmod_cgi.so,thenrestarttheserver.2.VerifythescriptisinaproperlyconfigureddirectorywithScriptAliasorExecCGIoptionsenabled.3.Setfilepermissionsto755andownershiptothewebuser(e.g.,www-data).4.Conf


Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft