Toggle navigation
TechnoWikis.com
Email or Username
Password
Remember
Login
Register
|
I forgot my password
All Activity
Questions
Hot!
Pending
Ask a Question
Privacy Policy
Contact
How to mount Apache web server, PHP 5 and Mysql from scratch
Home
Tutorials
Development
Web Servers
How to mount Apache web server, PHP 5 and Mysql...
(adsbygoogle = window.adsbygoogle || []).push({});
+5
votes
299
views
How to mount Apache web server, PHP 5 and Mysql from scratch
asked
Jun 24, 2019
in
Web Servers
by
backtothefuture
(
552k
points)
reopened
Jun 24, 2019
|
299
views
answer
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Add answer
Cancel
1
Answer
+3
votes
Best answer
We will develop how to install, configure and optimize a web server under Linux.
The tutorial is valid for any distribution by changing the corresponding commands to install or update files.
In this case it will be done for a CentOS distribution.
The first step is to connect to our server through ssh from the terminal.
When we access the server we proceed to install Apache.
root @ server1: ~ # yum install httpd
Then we install php, be careful with the version that we install, because if it is very new, many web applications could become obsolete and not work.
root @ server1: ~ # yum
apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi
We install Mysql
root @ server1: ~ # yum install mysql mysql-server
In order to manage Mysql we can install phpmyadmin
root @ server1: ~ #
yum install phpmyadmin
Configuring and optimizing server service
The first thing we will do is that apache starts automatically with the system, otherwise we should start it manually
root @ server1: ~ # yum chkconfig --level 235 httpd on
Restart or start the apache service manually (Restart or Start)
root @ server1: ~ # yum /etc/init.d/httpd start
We will also tell mysql to start automatically and start the service
root @ server1: ~ # yum chkconfig --level 235 mysqld on
root @ server1: ~ # yum /etc/inti.d/mysqld start
To test if the server is installed and working we can visit the server's ip and the apache page should respond
Optimizing apache
Hide version and information sensitive to the public.
Malicious users can use this information to attack your server.
root @ server1: ~ #
nano /etc/httpd/conf/httpd.conf
Add these policies or change them for the following
ServerSignature Off
ServerTokens Prod
Deactivate directory browsing
Options -Indexes
Then save the changes and restart Apache
root @ server1: ~ #
/etc/init.d/httpd restart
Configure the following httpd.conf variables
root @ server1: ~ #
nano
/etc/httpd/conf/httpd.conf
Timeout
defines, in seconds, the time the server will wait to receive and transmit during communication.
60 and 300 seconds, This interferes with the sending of files by forms, TCP requests, GET, etc.
Therefore, it must be defined depending on the use of the server.
MaxClients
establishes a limit to the total of the processes of the server or clients connected simultaneously, that can execute at the same time, depending on the use varies the performance of the server.
KeepAliveTimeout
sets the number of seconds the server will wait after serving a request and closing the connection, usually 10 to 15 seconds.
Optimizing and configuring MYSQL
To optimize and configure mysql we are going to
root @ server1: ~ #
nano /etc/my.cnf
Some variables to optimize and configure are:
Create a log where queries that take more than 2 seconds to optimize are saved
log-slow-queries = / var / log / mysql-slow-queries.log
long_query_time = 2 (in seconds)
Disconnect any inactive client in x seconds, thus avoiding that it occupies a connection
wait_timeout = 30
connect_timeout = 10
You can also configure the cache size and memory buffer that will depend on the needs of the server.
Optimizing php
The most important thing about php is to optimize php.ini, in this case it will depend on the needs of your applications
root @ server1: ~ #
nano
/etc/php.ini
max_execution_time
- This determines the time a script can take to run, if you are using scripts that consume a lot of resources it may be convenient to adjust this in the most convenient way.
memory_limit
- If your script uses a lot of memory to run effectively, since some of the shared hosting services only allow 16 MB, if you can configure it better put it in 32 MB.
post_max_size
- If you have a site where users can upload files to the server, here you can configure the maximum size limit of the files they can upload, from the POST method, for tasks to import or upload files and images.
answered
Jun 24, 2019
by
stackoverflow
(
3.5m
points)
edited
Jun 24, 2019
ask related question
comment
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Add comment
Cancel
Related questions
+4
votes
1
answer
Mount a Cloud server in Ubuntu
asked
Jun 23, 2019
in
Web Servers
by
backtothefuture
(
552k
points)
|
201
views
+3
votes
1
answer
Seo positioning from PHP and Apache
asked
Jun 24, 2019
in
SEO
by
backtothefuture
(
552k
points)
|
367
views
+5
votes
1
answer
Import a file from a calculation template to Mysql with php
asked
Jun 23, 2019
in
PHP
by
backtothefuture
(
552k
points)
|
264
views
+5
votes
1
answer
How to install Apache Web server on Ubuntu 18.04
asked
Oct 15, 2019
in
Linux / Unix
by
backtothefuture
(
552k
points)
|
236
views
+5
votes
1
answer
How to create Apache Virtual Host in Ubuntu LTS
asked
Jun 23, 2019
in
Web Servers
by
backtothefuture
(
552k
points)
|
239
views
Sponsored articles cost $40 per post. You can contact us via
Feedback
All categories
Tutorials
7.5k
Microsoft
1.9k
Android
1.4k
Security
120
Linux / Unix
543
Internet
757
Virtualization
104
Apple
611
Networks
64
Other Devices
321
Other Applications
184
Hardware
19
Development
53
HTML5 / CSS3
12
Web Servers
9
JavaScript
12
Other languages
2
PHP
8
CMS
4
Python
5
WebServers
1
Digital Marketing
47
Databases
14
Graphic Design
30
Guides
794
GraphicDesign
54
Networking
4
PlayStation
186
Gaming
55
Linux/Unix
85
Manzana
33
Otherdevices
38
Otherapps
49
Digitalmarketing
39
Safety
1
Developing
2
Help
685
Social Networks
34
Android Tutorial
549
iPhone Tutorial
267
News
17
Social
6
Phone
11
Telephone
9
Applications
167
Smartphones
3
Cell Phones
11
Applications
25
Travels
6
Photo
21
Education
18
Games
25
Internet
14
Music
8
Technique
10
Video
6
Windows
5
Apple
2
Cell Phones
3
TikTok
216
Trips
2
House
1
Operating System
5
Tips & Tricks
892
Solutions
6
Tutorials
3
FAQ
1
Applications
5
Cell Phones
2
Tutorials
4
Computers
6
Tutoriales
2
8
Technology
2
In Computers
1
In Applications
2
Tutorials Tutorials
9
Applications Applications
25
Aplicaciones Applications
4
Devices Devices
5
Tutoriales Tutorials
1
Tutorials u00a0 Tutorials
2
Applications u00a0 Applications
2
Devices u00a0 Devices
1
OS OS
1
Etc Etc
2
Most popular questions within the last 30 days
Please leave a comment about whether the solution works or not (with device model)
[X]Close
10,659
questions
10,791
answers
510
comments
3
users