You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2024-11-07-nginx.md
+21-1
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,7 @@ To set up NGINX on your server, follow these steps (using an Ubuntu server as an
61
61
2. Set Up Basic Configuration:
62
62
63
63
- Open the configuration file:
64
+
64
65
---
65
66
sudo nano /etc/nginx/sites-available/default
66
67
---
@@ -82,64 +83,78 @@ To set up NGINX on your server, follow these steps (using an Ubuntu server as an
82
83
3. Start NGINX:
83
84
84
85
- After making your changes, start NGINX:
86
+
85
87
---
86
88
sudo systemctl restart nginx
87
89
---
88
90
89
91
4. Test:
90
92
91
-
Visit http://your-server-ip/ in your browser and check if the site is live.
93
+
-Visit http://your-server-ip/ in your browser and check if the site is live.
92
94
93
95
---
96
+
94
97
NGINX is an incredibly powerful, fast, and efficient tool for managing web traffic. Its advantages, such as high scalability, low resource usage, and flexibility, make it an excellent choice for any web developer or system administrator. Whether you're using it as a web server, reverse proxy, load balancer, or for SSL/TLS termination, NGINX can significantly improve the performance and security of your applications.
95
98
99
+
96
100
# Some more important commands
101
+
97
102
- Stopping NGINX
103
+
98
104
---
99
105
sudo systemctl stop nginx
100
106
---
101
107
102
108
- Restarting NGINX
109
+
103
110
---
104
111
sudo systemctl restart nginx
105
112
---
106
113
107
114
- Reloading NGINX Configuration
115
+
108
116
---
109
117
sudo systemctl reload nginx
110
118
---
111
119
112
120
- Checking the Status of NGINX
121
+
113
122
---
114
123
sudo systemctl status nginx
115
124
---
116
125
117
126
- Enabling NGINX on Startup
127
+
118
128
---
119
129
sudo systemctl enable nginx
120
130
---
121
131
122
132
- Disabling NGINX on Startup
133
+
123
134
---
124
135
sudo systemctl disable nginx
125
136
---
126
137
127
138
- Testing the Configuration for Errors
139
+
128
140
---
129
141
sudo nginx -t
130
142
---
131
143
132
144
- Running NGINX as a Background Process
145
+
133
146
---
134
147
sudo nginx
135
148
---
136
149
137
150
- Stopping NGINX without systemd
151
+
138
152
---
139
153
sudo nginx -s stop
140
154
---
141
155
142
156
- Reloading Configuration without Stopping NGINX
157
+
143
158
---
144
159
sudo nginx -s reload
145
160
---
@@ -148,16 +163,19 @@ NGINX is an incredibly powerful, fast, and efficient tool for managing web traff
148
163
149
164
Access error or access logs to diagnose issues. On Ubuntu, logs are typically located at /var/log/nginx/.
150
165
- Error log:
166
+
151
167
---
152
168
tail -f /var/log/nginx/error.log
153
169
---
154
170
155
171
- Access log:
172
+
156
173
---
157
174
tail -f /var/log/nginx/access.log
158
175
---
159
176
160
177
- Running in Foreground (without systemd)
178
+
161
179
---
162
180
sudo nginx -g "daemon off;"
163
181
---
@@ -170,7 +188,9 @@ NGINX is an incredibly powerful, fast, and efficient tool for managing web traff
170
188
---
171
189
172
190
- Reopening Log Files
191
+
173
192
---
174
193
sudo nginx -s reopen
175
194
---
195
+
176
196
These commands cover the basics for managing NGINX on a Linux server, including routine maintenance, restarting, testing configurations, and checking the server’s status.
0 commit comments